Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DRAW() not working as expected
Message
 
 
À
13/06/2013 19:55:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01576345
Message ID:
01576368
Vues:
29
>>>>>Also, one thing you might do after your Draw() code is add this:
>>>
DECLARE INTEGER InvalidateRect  IN WIN32API INTEGER hwnd, INTEGER ignore1, INTEGER ignore2
>>>InvalidateRect(thisForm.hwnd, 0, 0)  && Just repaint foreground items
>>>*InvalidateRect(thisForm.hwnd, 0, 1)  && Also repaint the background coloring
>>>>>
>>>>>That will force the window to repaint itself at the Windows OS level, and may help it "go away".
>>>>
>>>>The Themes = .F. had no effect.
>>>>But InvalidateRect() does work perfectly, I don't even need to call THISFORM.Draw().
>>>>So I created a method THISFORM.Redraw() and put the API call in there.
>>>>Thank you!
>>>
>>>
>>>You're welcome. I updated the note above about the ignore1 and ignore2 values. The ignore2 parameter is actually "redrawBackground?"
>>
>>PMFJI, but I was wondering if the above code (using InvalidateRect) would work for a following case:
>>I have a form that processes many items (actually printing report for each item). So I wanted to show the ID of the item being processed in a textbox on the form. I have code:
>>
>>thisform.Draw
>>DOEVENTS
>>
>>in the DO WHILE loop where the items are being processed. It never actually showed the items (at least I never could see them). But I left the code there and since the customers didn't complain, I forgot about it. If I replace my thisform.Draw with the above API function call, do you think it will work showing the items being processed? And if yes, would it make sense to call the
>>
>>DECLARE INTEGER InvalidateRect  IN WIN32API INTEGER ...
>>
>>only once at the top of the procedure and then only call Invalidate() after every record ID is set in the textbox on the form?
>>Thank you.
>
>
>The WM_PAINT message is the message the Windows OS sends out to the program running the window (Visual FoxPro) to tell it to redraw itself. Until you are in the READ EVENTS loop, and in a place where it is processing events, it won't update. Using InvalidateRect() in combination with DOEVENTS or DOEVENTS FORCE if you really need it to update will likely work, but will impact tight loop processing performance.

Thank you. I will probably test it to see what kind of performance "hit" it would make. Also in my program, at each LOOK a report is printed. So this takes time anyway. So the millisecond delay will not make a lot of difference.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform