Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drawing lines
Message
From
12/05/2008 05:21:45
 
 
To
12/05/2008 05:16:35
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
01316207
Message ID:
01316354
Views:
19
>>>Hi All,
>>>
>>>I have a form. At runtime I add a bunch of objects to the form, mainly rectangular shapes. I then want to draw some lines over those shapes using THISFORM.LINE(X,Y) method.
>>>
>>>Pseudo code 1:
>>>
>>>
>>>THISFORM.LOCKSCREEN=.T.
>>>ADDOBJECT( shapes )  &&  mulitple shapes added
>>>THISFORM.LINE(X,Y)   &&  multiple lines needed
>>>THISFORM.LOCKSCREEN=.F.
>>>
>>>
>>>In the above example either no lines are shown or they are shown but behind the shapes even though the shapes were drawn/added first.
>>>
>>>Pseudo Code 2:
>>>
>>>
>>>THISFORM.LOCKSCREEN=.T.
>>>ADDOBJECT( shapes )  &&  mulitple shapes added
>>>THISFORM.LOCKSCREEN=.F.
>>>
>>>THISFORM.LOCKSCREEN=.T.
>>>THISFORM.LINE(X,Y)   &&  multiple lines needed
>>>THISFORM.LOCKSCREEN=.F.
>>>
>>>
>>>In this example again no lines are drawn or they incorrectly appear behind the shapes.
>>>
>>>However, if I introduce an INKEY() between the two operations the lines appear correctly and on top of the shapes as desired. i.e.;
>>>
>>>Pseudo Code 3:
>>>
>>>
>>>THISFORM.LOCKSCREEN=.T.
>>>ADDOBJECT( shapes )
>>>THISFORM.LOCKSCREEN=.F.
>>>
>>>INKEY(0.01)
>>>
>>>THISFORM.LOCKSCREEN=.T.
>>>THISFORM.LINE(X,Y)
>>>THISFORM.LOCKSCREEN=.F.
>>>
>>>
>>>Substituting DOEVENTS for the INKEY() does not work. Only using INKEY() (or probably some other wait state I assume).
>>>
>>>
>>>Why?
>>
>>Jos,
>>
>>I think foxpro does not process the screen redraw until it has some time (IdleState). The inkey() gives foxpro the time to process those things
>>
>>Maybe try thisform.Draw() instead of inkey(). If this works you can try it in pseude code 1
>>
>>ps: there was a thread some time ago about a label not sizing immediately after the caption was reassigned. I answered I had used an inkey()
>
>Gregory,
>
>THISFORM.DRAW() can replace the INKEY() in pseduo code 3. However, it still does not work in pseduo code 1 or 2. Thanks for the feedback.

Jos,

I have found Dragan's answer to shed some further light

What if (in pseudo code 1) you put the draw() as indicated below ?
>>THISFORM.LOCKSCREEN=.T.
>>ADDOBJECT( shapes )  &&  mulitple shapes added

thisform.Draw()

>>THISFORM.LINE(X,Y)   &&  multiple lines needed
>>THISFORM.LOCKSCREEN=.F.
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform