store/restore parts of the screen

store/restore parts of the screen

Postby Otto » Thu Mar 15, 2007 8:25 am

Could someone please help?
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Re: store/restore parts of the screen

Postby Enrico Maria Giordano » Thu Mar 15, 2007 8:47 am

You should not need to save/restore screen under Windows (or any other GUI).

What do you want to achieve, exactly?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8538
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Thu Mar 15, 2007 4:47 pm

Hello Enrico,
I need an undo function on painting lines.

Please have a look at:
http://www.winhotel.net/1plan5/
(press mouse-button and keep it down )


In this case I use asp and js but I need the same in FW.

Otto
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Thu Mar 15, 2007 5:50 pm

You don't have to save/restore screen. Instead you have to use a control that knows how to repaint itself. This is the basics of event driven programming.

In details, the board repaints itself using a list of lines coordinates. When you remove a line really remove its coordinates from the list and then refresh the board.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8538
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Thu Mar 15, 2007 6:19 pm

A control for this as far as I know doesn’t exist.
Therefore you have to do it yourself.
>control that knows how to repaint itself
How is it made inside?
To refresh the board if it is full of information is a time-consuming task.
Therefore it would be better only to restore a part of the screen.

Otto
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Thu Mar 15, 2007 6:57 pm

Otto wrote:How is it made inside?


Just use the paint event of any container.

Otto wrote:To refresh the board if it is full of information is a time-consuming task.
Therefore it would be better only to restore a part of the screen.


You can't. What if the board is covered by another window? It has to repaint itself.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8538
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Thu Mar 15, 2007 9:09 pm

>You can't. What if the board is covered by another window? It has to repaint itself.
Shure I have a repaint-button, too. But a window which covers another window must restore the background if you close it.
Or am I wrong?
Otto
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Thu Mar 15, 2007 10:08 pm

Otto wrote:Shure I have a repaint-button, too. But a window which covers another window must restore the background if you close it.
Or am I wrong?


You are wrong. They are the controls in background that repaint themselves. This is how Windows works.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8538
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby R.F. » Fri Mar 16, 2007 1:27 am

Otto:

Enrico is Right !!!!!, it's very easy to creat a control that repaints itself from source code:

http://www.google.d2g.com/objeto/prueba2d.exe

In this sample I draw by hand a grid to later print a line graph, as you can notice, you can resize the window container and the graph will paint itself as necesary, there's no delay or time comsuming with it.

If you try this sample:

http://www.google.d2g.com/objeto/test2.exe

I have converted the previous code into a control code, play around with buttons and you will see how the graphs change in run time, with no speed degradation at all.



, this is the sample:

Maybe is what you need.
Saludos
R.F.
R.F.
 
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Postby Otto » Fri Mar 16, 2007 6:42 am

Thank you Rene. These are nice samples.

I the meantime I had a closer look into Pezold and read about WM_PAINT and InvalidateRect.

Please could you have a look at the topic:
Can I change the report viewer ?

Isn't that a heavy-duty to repaint the whole window every time you move the mouse?


HairCross Cursor:

Insert

oMeta1:bMMoved:={|y,x,flags|hairCross(oMeta1,y,x) }

in FUNCTION RPreview( oDevice ) in rpreview.prg.

func hairCross(oMeta1,y,x)
nCount:=nCount+1
IF nCount > 5
nCount:=0
oMeta1:refresh()
sysrefresh()
oMeta1:line (0,x,1800,x)
oMeta1:line (y,0,y,1500)
ENDIF
return nil
User avatar
Otto
 
Posts: 6255
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests