Skip to main content

I am wanting to update the positions of fields on a form multiple times a second as if they are being animated. I'm struggling to find a way to do this. I tried using sleep in a while loop but it causes the UI to hang.

Looking around, the UTimer or some kind of periodic messaging to run triggers may work, but I don't know how to use those things. 

Any thoughts? 



------------------------------
R T
Emporer
Rocket Software Forum Member
------------------------------

I am wanting to update the positions of fields on a form multiple times a second as if they are being animated. I'm struggling to find a way to do this. I tried using sleep in a while loop but it causes the UI to hang.

Looking around, the UTimer or some kind of periodic messaging to run triggers may work, but I don't know how to use those things. 

Any thoughts? 



------------------------------
R T
Emporer
Rocket Software Forum Member
------------------------------

i would look at the command show, and put it within the loop



------------------------------
Osman Shariff
Freelance Uniface Consultant - France

Private message me if you need help with a project
English, French, German
------------------------------

i would look at the command show, and put it within the loop



------------------------------
Osman Shariff
Freelance Uniface Consultant - France

Private message me if you need help with a project
English, French, German
------------------------------

Interesting, thank you. Do you have any solution to being able to handle user input while this loops happens? Right now, any interaction seems frozen while in that loop. 



------------------------------
R T
Emporer
Rocket Software Forum Member
------------------------------

Interesting, thank you. Do you have any solution to being able to handle user input while this loops happens? Right now, any interaction seems frozen while in that loop. 



------------------------------
R T
Emporer
Rocket Software Forum Member
------------------------------
If you want to have user interaction, you will have to return to the structure editor. This will involve using UTIMER to send a message, and then catching that message in the receivemessage/async trigger to perform the next step in the processing.

It is unlikely, however, that Uniface will react fast enough to allow for any significant user input if you are attempting to update “Several times a second”.



Regards,

Iain








Iain Sharp | Head of Technical Services
Jonas Metals Software
iains@jonasmetals.com
tel +44 (0) 114 201 2200
www.jonasmetals.com Book Time With Me

If you want to have user interaction, you will have to return to the structure editor. This will involve using UTIMER to send a message, and then catching that message in the receivemessage/async trigger to perform the next step in the processing.

It is unlikely, however, that Uniface will react fast enough to allow for any significant user input if you are attempting to update “Several times a second”.



Regards,

Iain








Iain Sharp | Head of Technical Services
Jonas Metals Software
iains@jonasmetals.com
tel +44 (0) 114 201 2200
www.jonasmetals.com Book Time With Me

Starting a utimer. 

	newinstance "UTIMER","%%$instancename%%%_UT"
	if($status = -154)
		activate "%%$instancename%%%_UT".STOP()
	endif
	activate "%%$instancename%%%_UT".SETREPEAT(1)
	activate "%%$instancename%%%_UT".SETMESSAGE($instancename,"REFRESH","%%$datim%%%")
	activate "%%$instancename%%%_UT".START("00:00:01")

Catching the message in the async/receivemessage trigger. 

trigger receiveMessage
	if($result="message")
		selectcase $msgid
		case "REFRESH"

This will run one instance of the message, so if you want it to repeat, run the start process again at the end of the code called by the async trigger (or set the setrepeat option to a very large number and use STOP to close the utimer down when appropriate. 

It appears that 'one second' is the minimum timer. (You might try setting a variable to a smaller number of ticks and then using that as the parameter.)

Regards, 

Iain



------------------------------
Iain Sharp
Head of Technical Services
Jonas Metals Software Limited
Sheffield GB
------------------------------

Starting a utimer. 

	newinstance "UTIMER","%%$instancename%%%_UT"
	if($status = -154)
		activate "%%$instancename%%%_UT".STOP()
	endif
	activate "%%$instancename%%%_UT".SETREPEAT(1)
	activate "%%$instancename%%%_UT".SETMESSAGE($instancename,"REFRESH","%%$datim%%%")
	activate "%%$instancename%%%_UT".START("00:00:01")

Catching the message in the async/receivemessage trigger. 

trigger receiveMessage
	if($result="message")
		selectcase $msgid
		case "REFRESH"

This will run one instance of the message, so if you want it to repeat, run the start process again at the end of the code called by the async trigger (or set the setrepeat option to a very large number and use STOP to close the utimer down when appropriate. 

It appears that 'one second' is the minimum timer. (You might try setting a variable to a smaller number of ticks and then using that as the parameter.)

Regards, 

Iain



------------------------------
Iain Sharp
Head of Technical Services
Jonas Metals Software Limited
Sheffield GB
------------------------------

Super interesting Iian, ty. Will give it a try



------------------------------
R T
Emporer
Rocket Software Forum Member
------------------------------