|
Home > Archive > Programming with dBASE > November 2005 > Slow painting
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Mike Nunn 2005-11-17, 8:23 pm |
| I have revised some code to allow for different screen widths, the object
being to place forms centered horizontally. The tactic I have adopted is to
have the form invisible when opened and then have an OnOpen function which
calculates the position from the screen and form-widths and places the form
accordingly. Then it is made visible.
The forms in question contain only progress objects.
What seems to happen is that the subsequent code starts executing with the
progress object showing the progress, before the form is properly repainted,
so I just get bits of the form displayed.
If I don't make the form invisible first, and the screen is a different
width from my design environment, it continues to display the form in the
preset (design environment) position and introduces a second image for the
new position.
Any suggestions? The forms are called 'with true'.
Mike
| |
| Paul Van House 2005-11-17, 8:23 pm |
| In article <twaRUL76FHA.1492@news-server>, mbnunnuk@yahoo.co.uk says...
> I have revised some code to allow for different screen widths, the object
> being to place forms centered horizontally. The tactic I have adopted is to
> have the form invisible when opened and then have an OnOpen function which
> calculates the position from the screen and form-widths and places the form
> accordingly. Then it is made visible.
>
> The forms in question contain only progress objects.
>
> What seems to happen is that the subsequent code starts executing with the
> progress object showing the progress, before the form is properly repainted,
> so I just get bits of the form displayed.
>
> If I don't make the form invisible first, and the screen is a different
> width from my design environment, it continues to display the form in the
> preset (design environment) position and introduces a second image for the
> new position.
>
> Any suggestions? The forms are called 'with true'.
>
> Mike
>
>
>
>
If these are non-MDI windows, you can set AutoCenter to True and the
form automatically appears centered on the screen
If you're talking about MDI windows within the app's frame window
AutoCenter will center the form in the frame window.
That being said, in addition to (or instead of) making the form
invisible, have its initial position be off-screen (top = -500, Left = -
500) then after your calculations are made the screen should then appear
in the proper position.
If processing on the form is started before the form is positions (you
mentioned progress controls but I would imagine you have some sort of
table processing going on) repainting is slow by default since table
processing hogs the CPU. To help with this, try a couple of things:
Set _app.AllowYieldOnMsg to True. This forces your program to take a
small break and process things like screen paints and gives other
applications a chance to function closer to normal. This, of course,
will slow down your application's processing speed.
Issue a _app.ExecuteMessages() - this forces the application to process
any messages such as window repaints when the command is issued.
The ultimate solution is to position the form first, THEN being the
processing.
--
Paul Van House
remove ".removeme" for e-mail replies
Radio/TV Software and Baseball Stat Software:
http://www.binxsoftware.com
Family Home Page: http://vanhouse.binxsoftware.com
Church Home Page: http://www.ashfordumc.org
| |
| evilaro 2005-11-17, 8:23 pm |
| Paul:
Where do you find the explanation for this
_app and similar ones.
_app.AllowYieldOnMsg
_app.ExecuteMessages()
I do not find them on the OLH
Thanks
Emilio
| |
| Mike Nunn 2005-11-17, 8:23 pm |
| Paul Van House wrote, inter alia '> Issue a _app.ExecuteMessages()'
Thank you for your helpful suggestions - which have improved the situation
greatly on the form I have tried them on.
But the _app.ExecuteMessages() function seems not to be there. Is it new?
I am working with v 2.21 currently (I have 2.6 but am postponing using to
retain compatibilty with an application in use).
Re Autocenter, the forms I referred to are not intended to be centered
vertically, only horizontally.
Mike
PS - apologies - I clicked the wrong button the first time and did not
'Reply Group'.
| |
| Paul Van House 2005-11-17, 8:23 pm |
| In article <A9rs6w76FHA.1232@news-server>, buzon@evil.es says...
> Where do you find the explanation for this
> _app and similar ones.
> _app.AllowYieldOnMsg
> _app.ExecuteMessages()
>
>
Look in OHL under _app -- there is a list of properties and
methods....at least there is in SL6. I must admit I learned about
ExecuteMessages() from another recent post.
--
Paul Van House
remove ".removeme" for e-mail replies
Radio/TV Software and Baseball Stat Software:
http://www.binxsoftware.com
Family Home Page: http://vanhouse.binxsoftware.com
Church Home Page: http://www.ashfordumc.org
| |
| Paul Van House 2005-11-17, 8:23 pm |
| In article <R5tuTA86FHA.1492@news-server>, mbnunnuk@yahoo.co.uk says...
> Paul Van House wrote, inter alia '> Issue a _app.ExecuteMessages()'
>
> Thank you for your helpful suggestions - which have improved the situation
> greatly on the form I have tried them on.
You're welcome
> But the _app.ExecuteMessages() function seems not to be there. Is it new?
I'm not sure when executemessages was added. I'm using 2.6
--
Paul Van House
remove ".removeme" for e-mail replies
Radio/TV Software and Baseball Stat Software:
http://www.binxsoftware.com
Family Home Page: http://vanhouse.binxsoftware.com
Church Home Page: http://www.ashfordumc.org
| |
| Ronnie MacGregor 2005-11-17, 8:23 pm |
| In article <R5tuTA86FHA.1492@news-server>, mbnunnuk@yahoo.co.uk says...
> But the _app.ExecuteMessages() function seems not to be there. Is it new?
2.5 onwards
--
Ronnie MacGregor
Scotland
www.dBASEdeveloper.co.uk
| |
| Ken Mayer [dBVIPS] 2005-11-18, 9:23 am |
| Ronnie MacGregor wrote:
> In article <R5tuTA86FHA.1492@news-server>, mbnunnuk@yahoo.co.uk says...
>
>
>
>
> 2.5 onwards
>
There is a function in the dUFLP's MiscAPI.prg that emulates the
_app.ExecuteMessages() functionality, I believe ... check that.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Mike Nunn 2005-11-19, 11:23 am |
|
Ken Mayer wrote:
> There is a function in the dUFLP's MiscAPI.prg that emulates the
> _app.ExecuteMessages() functionality, I believe ...
Thanks Ken - there is a mystery here. I checked miscapi.prg. I guess the
relevant function is repaint() by Jim Sare..
It is there in the library form list, but doesn't seem to actually be there
in miscapi.prg now.
Any clue where it might have migrated to?
I got your book - a veritable mine of useful information. Thanks, I hope it
rakes in some income for you.
Mike
| |
| Paul Van House 2005-11-21, 9:23 am |
| In article <#csS6#R7FHA.2064@news-server>, mbnunnuk@yahoo.co.uk says...
>
> Ken Mayer wrote:
>
> Thanks Ken - there is a mystery here. I checked miscapi.prg. I guess the
> relevant function is repaint() by Jim Sare..
>
> It is there in the library form list, but doesn't seem to actually be there
> in miscapi.prg now.
>
> Any clue where it might have migrated to?
>
> I got your book - a veritable mine of useful information. Thanks, I hope it
> rakes in some income for you.
>
> Mike
>
>
>
That's weird. I found it in FormStuff.prg. It's not too big so I
posted it below.
function Repaint
/*
This is a routine by Jim Sare with minor
modifications by Ken Mayer. It can be used
to ensure that if any processing has occurred
that the form gets repainted (which sometimes
doesn't happen) ...
Dec. 19, 1999: modified again by Romain Strieff,
basically a rewrite ...
You can repaint a specific object on a form
by passing the hWnd to the function, or
you can call this from with the form's hWnd,
or if you add this code into a form's
CLASS definition, just calling the method
will use the form's hWnd by default.
Ex:
class MyForm of form()
// insert repaint here, before ENDCLASS
endclass
To use:
for an object on the form:
form.repaint( form.text1.hwnd )
for the form:
form.repaint()
*/
if type("UpdateWindow") # "FP"
extern cLogical UpdateWindow( cHandle ) user32
endif
if argcount()=1
UpdateWindow(argVect
or(1))
else
UpdateWindow(form.hwnd)
endif
return
// end of Repaint()
--
Paul Van House
remove ".removeme" for e-mail replies
Radio/TV Software and Baseball Stat Software:
http://www.binxsoftware.com
Family Home Page: http://vanhouse.binxsoftware.com
Church Home Page: http://www.ashfordumc.org
| |
| Ken Mayer [dBVIPS] 2005-11-21, 9:23 am |
| Mike Nunn wrote:
> Ken Mayer wrote:
>
>
>
> Thanks Ken - there is a mystery here. I checked miscapi.prg. I guess the
> relevant function is repaint() by Jim Sare..
>
> It is there in the library form list, but doesn't seem to actually be there
> in miscapi.prg now.
>
> Any clue where it might have migrated to?
>
> I got your book - a veritable mine of useful information. Thanks, I hope it
> rakes in some income for you.
REPAINT() was moved to FormStuf.prg, I think. Also I am sure there is an
executeMessages function in the library. You might want to look at the
Library.wfm form to find it ...
Re: the book, thanks. I hope I see something too. I won't see anything
though until February (quarterly reports, quarter ends in December, with
TWO MONTHS for them to pay me after that ... sheesh!)
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Ken Mayer [dBVIPS] 2005-11-21, 9:23 am |
| Ken Mayer [dBVIPS] wrote:
> Ronnie MacGregor wrote:
>
>
>
> There is a function in the dUFLP's MiscAPI.prg that emulates the
> _app.ExecuteMessages() functionality, I believe ... check that.
Sorry, it is called DoEvents.prg ... my faulty memory ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Mike Nunn 2005-11-21, 1:23 pm |
| Thanks y'all
Mike
"Ken Mayer [dBVIPS]" < dbase@_nospam_golden
stag.net> wrote in message
news:2qCKGKq7FHA.1228@news-server...
> Ken Mayer [dBVIPS] wrote:
>
> Sorry, it is called DoEvents.prg ... my faulty memory ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/dbase/dBASEBook.htm
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
|
|
|
|
|