It is currently Sun May 31, 2020 6:26 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject:
PostPosted: Tue Apr 16, 2002 12:29 am 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Hi,

I was experimenting with the ResizeGadget() command today, and found that if I resized my window (gadget resize was linked to that) vertically, so that perhaps some of the previous gadgets horizontal borders would now be in the middle of a new gadget, it did not remove all of the old gadgets imagery from the window properly. Clicking on the gadgets drew them properly.

So:
is there some way to force a redraw/refresh of the contents of a window?
is ResizeGadget() supposed to do that and this is a bug?
is there something I've mised (like I need to remove the gadgets from a window before resizing them)? My code ATM checks the window size in the event loop and if it is different, goes through all my gadgets and calls ResizeGadget() for them. it does nothing else apart from that.

If you cannot imagine what the "corrupt" gadgets look like, I will try to arrange a screenshot or demo program or something.

Thanks.


--
It's not minimalist - I'm increasing efficiency by reducing input effort.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 16, 2002 3:23 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Franco.

Have you tried to call:
WindowEvent() : WindowEvent() ; call it twice...

In early days this worked out (Mr.Skunks tip)


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 16, 2002 10:27 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Quote:
Have you tried to call:
WindowEvent() : WindowEvent() ; call it twice...


You mean after I resize the gadgets? I tried it there just now and it did not work. Thanks for the advice though.

In case anyone is interested I have now uploaded an archive with a demo program and a picture of the corruption to my homepage - http://www.david-mcminn.co.uk

--
It's not minimalist - I'm increasing efficiency by reducing input effort.

Edited by - tinman on 17 April 2002 00:22:48


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 17, 2002 4:25 am 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Danilo.

Cant say without seeing the source.

And the tip by Franco:
> (WindowEvent() : WindowEvent() ; call it twice

should be
Code:
 While WindowEvent(): Wend


This makes sure that all messages waiting
in the queue are processed now.
I had some repaint problems too, and with
this single line everything is gone and
repainting is fast.

But maybe thats another problem here -
cant say without seeing the source.

cya,
...Danilo

(registered PureBasic user)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 17, 2002 11:17 am 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Quote:
Cant say without seeing the source.


Yeah, I thought as much. I was hoping that it was something simple that someone might have seen before, but it seems not. Thanks for the help though, I'll go back and figure out some more tests.



--
It's not minimalist - I'm increasing efficiency by reducing input effort.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 17, 2002 3:23 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Quote:
Yeah, I thought as much. I was hoping that it was something simple that someone might have seen before, but it seems not. Thanks for the help though, I'll go back and figure out some more tests.


Sorry for replying, but it will highlight this top as having new posts, perhaps attracting new readers :wink:

Anyway, here is some code that will replicate the problem:
Code:
if initgadget(10)=0:end:endif

if openwindow(0,400,300,300,140,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget, "Layout Test")

    if creategadgetlist(windowid())

        ButtonGadget(0,20,22,200,20,"First")
        ButtonGadget(1,20,46,200,20,"Second")
   
        while quit.w=0
            ev.l=WaitWindowEvent()
            If ev=#PB_EventCloseWindow : quit=1 : endif

            If WindowHeight()140
                ; Resize gadgets so they overlap
                ResizeGadget(0,20,44,200,20)
                ResizeGadget(1,20,91,200,20)
                ; I tried sticking a "While WindowEvent():Wend" loop here but it did not help
                quit=1
            EndIf
        wend

        quit=0
        while quit.w=0
            ev.l=WaitWindowEvent()
            If ev=#PB_EventCloseWindow : quit=1 : endif
        wend
       
    endif

    closewindow(0)
endif
end


Hope this can throw some more light on the problem.


--
It's not minimalist - I'm increasing efficiency by reducing input effort.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 17, 2002 3:49 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by Franco.

Hi Tinman, thanks for the sample code.
This helps a lot to track down the bug.

I have two solutions for you:

First:
Change the sequence of ResizeGadget to:

ResizeGadget(1,20,91,200,20)
ResizeGadget(0,20,44,200,20)

Second:
Call the Gadgets this way to get the handle of the gadgets:

Butt0=ButtonGadget(0,20,22,200,20,"First")
Butt1=ButtonGadget(1,20,46,200,20,"Second")

than call right after:

ResizeGadget(0,20,44,200,20)
ResizeGadget(1,20,91,200,20)

RedrawWindow_(Butt1,0,0,7)

Well this is an API command that I normally use for Windows (Frames) not for Controls.
But it works.
Hope this works with your WindowsOS as well.


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 17, 2002 6:17 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by PB.

> is there some way to force a redraw/refresh of the contents of a window?

Does my tip found here help in any way?

http://forums.purebasic.com/english/viewtopic.php?t=932


PB - Registered PureBasic Coder


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 17, 2002 6:30 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by tinman.

Quote:
> is there some way to force a redraw/refresh of the contents of a window?

Does my tip found here help in any way?


Doh! This is what I'm used to doing from the Amiga (freeing gadgets and creating them again). And it is probably what I would have tried first rather than ResizeGadget() if FreeGadget() was mentioned in the manual! Grrrr.

I'll try it tonight, but I'm sure it will work. Thanks.
Additional: Yes, it works perfectly now. Woohoo!

--
It's not minimalist - I'm increasing efficiency by reducing input effort.

Edited by - tinman on 17 April 2002 19:41:53


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 02, 2002 7:56 pm 
Offline
PureBasic Guru
PureBasic Guru

Joined: Tue Apr 22, 2003 7:42 pm
Posts: 16777133
Restored from previous forum. Originally posted by fred.

Fixed.

Fred - AlphaSND


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye