Resizing ExplorerList gadgets from a callback

Windows specific forum
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Resizing ExplorerList gadgets from a callback

Post by tinman »

Hello,

(fr34k, this is what I asked you about a few days ago ;)

I'm trying to resize some gadgets from a window callback. The code below shows the problem I am having - when I resize the gadgets only the one on the right is redrawn. It also happens with ExplorerTree gadgets.

In this code you can move the mouse left and right over the window (but NOT! over the explorerList gadgets) to resize the gadgets.

Code: Select all

Procedure.l Balance_Callback(*window.l, Message.l, wParam.l, lParam.l)
    DefType.l   result

    If Message=#WM_MOUSEMOVE And UseWindow(0)
        mx = WindowMouseX()
        my = WindowMouseY()
        
        If mx>10 And mx<390 And my>10 And my<390
            LockWindowUpdate_(WindowID())
            width1 = mx
            ResizeGadget(1, -1, -1, width1, -1)
            ResizeGadget(2, 4 + width1 + 4, -1, 400 - width1, -1)
            LockWindowUpdate_(0)
            
            UpdateWindow_(WindowID())
        EndIf
    EndIf
    
    result = #PB_ProcessPureBasicEvents
    ProcedureReturn result
EndProcedure


If OpenWindow(0, 400, 400, 412, 300, 0, "fghjk", 0)
    SetWindowCallback(@Balance_Callback())

    width1.l = 200

    If CreateGadgetList(WindowID())
        ExplorerListGadget(1, 4, 50, width1, 200, "c:\*.*", 0)
        ExplorerListGadget(2, 4 + width1 + 4, 50, 400 - width1, 200, "c:\*.*", 0)
        ButtonGadget(3, 156, 4, 100, 20, "Redraw", 0)
    EndIf

    While ev.l <> #PB_Event_CloseWindow
        ev.l = WaitWindowEvent()
        If ev=#PB_Event_Gadget
            If EventGadgetID()=3
            EndIf
        EndIf
    Wend
    
EndIf
End
Now, it's either because I'm doing something naughty with the callbacks or the explorer list gadget is screwed. Either answer will suit me as long as some explanation comes with it ;p

Thanks.
Last edited by tinman on Mon Jun 23, 2003 9:56 pm, edited 1 time in total.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

...doing something naughty with the callbacks...
Hehehe... 8O

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Hum, strange thing...

Works just fine here, what system do you use?

I guess I'll have to pass this on to fred anyway, as this Gadget uses the
generic resize function of PB.

Fred: can you please have a look?

btw: can you please test this with two ListIconGadgets() ? ListIconGadget
should be exactly the same as ExplorerListGadget() from the resize point
of view.

[sarcastic]
2 more questions...
- what misterious thing does that 'Redraw' button in your code do?
- ever heared of SplitterGadget() ?
:mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen:
[/sarcastic]

... sorry, just had to say that :wink:

Timo
quidquid Latine dictum sit altum videtur
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Well... fred and me, none of us has an answer. :cry:

Maybe you really do "...doing something naughty with the callbacks..." :wink:

Can anyone else confirm this behaviour, and provide me with some
info ? OS, IE version, etc...

thanks,

Timo
quidquid Latine dictum sit altum videtur
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

I don't see any problems.. or maybe I just don't get it... :roll:

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

freak wrote:Works just fine here, what system do you use?
See my signature ;p
btw: can you please test this with two ListIconGadgets() ? ListIconGadget
should be exactly the same as ExplorerListGadget() from the resize point
of view.
Yes, it works fine with ListIcon gadgets.
- what misterious thing does that 'Redraw' button in your code do?
It was from when I was testing the resizing code before realising it must be callback related.
- ever heared of SplitterGadget() ?
Given the amount of time I've wast^H^H^H^Hspent on this code I'm going to have to get it working. Besides, my own splitter gadget doesn't have all the bugs of Fred's ;p
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

Well, I found a workaround. Not pleasant, but I suppose it works (we love you Win98!). Rather simple too - just let the window message come all the way back out to your main event loop and do the redrawing from there.

Yum.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply