Xojo Conferences
XDCMay2019MiamiUSA

[RB List] Pragma Directives (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Does MDI is supported
Next thread: Re: gettingstarted Digest, Vol 11, Issue 3


Re: Problems Reading and Writing to the Serial Port   -   martin.honeywill unusual.co.uk
  [RB List] Pragma Directives   -   Eirik Karlsen
    Re: [RB List] Pragma Directives   -   Aaron Ballman
    Re: [RB List] Pragma Directives   -   Joseph J. Strout
    Re: [RB List] Pragma Directives   -   Eirik Karlsen
    Re: [RB List] Pragma Directives   -   Joseph J. Strout
    Re: [RB List] Pragma Directives   -   Eirik Karlsen

[RB List] Pragma Directives
Date: 02.02.05 23:38 (Wed, 02 Feb 2005 23:38:12 +0100)
From: Eirik Karlsen
See the code below, In RB it works different than in all other BASICs I've dealt with.
This is probably why I have problems updating a statictext control in the midst of
computing intensive graphics.

When running this code in RB the numbers are not counting up as one would expect,
not in MS-Win anyway. Instead the window is held back until the end of the loop,
and then only showing the final count (in this case 59999).

Is there anything to do about this?
Maybe some code in the loop to halt and allow the OS time to update the control?

I bet this would solve the problem Im struggeling with in my program, and save me
a lot of effort rewriting my code.

'*******************************
dim i as double
for i = 0 to 59999
statictext1.text=str(i)
next i
'*******************************

Re: [RB List] Pragma Directives
Date: 02.02.05 23:39 (Wed, 2 Feb 2005 16:39:02 -0600)
From: Aaron Ballman
> Is there anything to do about this?

Add a call to StaticText1.Refresh in the loop so that it gets updated.
Since refreshing is time consuming (compared to looping), you may want
to refresh only every 5 or 10 times through the loop or something.

HTH!

~Aaron

Re: [RB List] Pragma Directives
Date: 02.02.05 23:46 (Wed, 2 Feb 2005 16:46:00 -0600)
From: Joseph J. Strout
At 11:38 PM +0100 2/2/05, Eirik Karlsen wrote:

>This is probably why I have problems updating a statictext control
>in the midst of computing intensive graphics.

Aaron suggested refreshing the control, which is a good idea.
Another good idea to consider is moving your computation into a
Thread. Threads execute the stuff in their Run event in the
background, while allowing the UI to update itself, respond to mouse
clicks, and so on. If you're doing a long computation, that's
usually the best choice from a user-experience point of view.

Best,
- Joe

Re: [RB List] Pragma Directives
Date: 02.02.05 23:54 (Wed, 02 Feb 2005 23:54:06 +0100)
From: Eirik Karlsen
Tried a refresh on both the control and the window...no change in
behavior...
the window only pops up after the loop has finished.
'***************
dim i as double
for i = 0 to 99990
StaticText1.Refresh
'window1.Refresh
statictext1.text=str(i)
next i
'***************

Aaron Ballman wrote:

> > Is there anything to do about this?
>
> Add a call to StaticText1.Refresh in the loop so that it gets updated.
> Since refreshing is time consuming (compared to looping), you may want
> to refresh only every 5 or 10 times through the loop or something.
>
> HTH!
>
> ~Aaron
> --
> REAL World 2005 - The REALbasic User Conference
> March 23-25, 2005, Austin, Texas
> <http://www.realsoftware.com/realworld>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://www.realsoftware.com/listarchives/lists.html>

Re: [RB List] Pragma Directives
Date: 03.02.05 00:01 (Wed, 2 Feb 2005 17:01:39 -0600)
From: Joseph J. Strout
At 11:54 PM +0100 2/2/05, Eirik Karlsen wrote:

>Tried a refresh on both the control and the window...no change in
>behavior...
>the window only pops up after the loop has finished.

If it's a case of the window needing to be shown or come to the
front, then a thread is definitely the way to go.

Best,
- Joe

Re: [RB List] Pragma Directives
Date: 03.02.05 00:13 (Thu, 03 Feb 2005 00:13:32 +0100)
From: Eirik Karlsen
Ok, I'm on it...

"Joseph J. Strout" wrote:

> At 11:54 PM +0100 2/2/05, Eirik Karlsen wrote:
>
> >Tried a refresh on both the control and the window...no change in
> >behavior...
> >the window only pops up after the loop has finished.
>
> If it's a case of the window needing to be shown or come to the
> front, then a thread is definitely the way to go.
>
> Best,
> - Joe