store/restore parts of the screen

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

store/restore parts of the screen

Post by Otto »

Could someone please help?
Thanks in advance
Otto
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: store/restore parts of the screen

Post by Enrico Maria Giordano »

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

What do you want to achieve, exactly?

EMG
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

>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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

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
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post by R.F. »

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.
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

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
Post Reply