SplitterGadget - I must be THICK!!!

Just starting out? Need help? Post your questions and find answers here.
johnfermor
User
User
Posts: 29
Joined: Wed Dec 31, 2003 3:17 pm

SplitterGadget - I must be THICK!!!

Post by johnfermor »

Hi

I am having difficulties designing a GUI with 3 components; 1 ListIcon Gadget and 2 Editor Gadgets. There are 2 spliter gadgets that I can't seem to get working.

The screen should look like [something] this;
http://aa.1asphost.com/olympianeducatio ... isplay.bmp

The best I've managed to do is display the components with 1 active splitter. The 2nd splitter seems to have a mind of its own.

I have searched through the archives and looked at some examples but I either don't understand them or can't 'adapt' them for my needs.

I would really appreciate some guidance here or source code would be better. I think I understand the callback to resize the splitter but help here may be useful also.

Thanks in advacnce.


John
:x
freak
PureBasic Team
PureBasic Team
Posts: 5950
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

1) create the 3 gadgets 1, 2 and 3
2) create a splitter (gadget 4) with 1 and 2
3) create another splitter (gadget 5) with the first splitter (4) and gadget 3

this should work fine.

Note: when resizing, you may only resize the outer splitter (5), nothing else.
The others get resized automatically as a result of the resizing of the outer
splitter. If you try to resize them all, it'll get screwed up.

Timo
quidquid Latine dictum sit altum videtur
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post by Danilo »

Code: Select all

Procedure WindowProc(hWnd,Msg,wParam,lParam)
  result = #PB_ProcessPureBasicEvents
  If Msg = #WM_SIZE And hWnd = WindowID(0)
    ResizeGadget(5,0,0,lParam&$FFFF,(lParam>>16)&$FFFF)
    result = 0
  EndIf
  ProcedureReturn result
EndProcedure

OpenWindow(0,0,0,500,400,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget,"Split")
  CreateGadgetList(WindowID())
  SetWindowCallback(@WindowProc())

  ListIconGadget(1,0,0,0,0,"Title",200,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
  EditorGadget(2,0,0,0,0)
  EditorGadget(3,0,0,0,0)

  ; splitter1: listicon and editor1
  SplitterGadget(4,0,0,500,300,1,2,#PB_Splitter_Vertical|#PB_Splitter_Separator)
    SetGadgetState(4,350) ; Set splitter width

  ; splitter2: splitter1 and editor2
  SplitterGadget(5,0,0,500,400,4,3,#PB_Splitter_Separator)
    SetGadgetState(5,300) ; Set splitter width

Repeat:Until WaitWindowEvent()=#PB_EventCloseWindow
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
johnfermor
User
User
Posts: 29
Joined: Wed Dec 31, 2003 3:17 pm

Post by johnfermor »

Thanks Danilo

That code does exactly what I needed and you've made it look so easy!

I'll study this and see if I can get my head around the SplitterGadget so I won't need to bother the forums again!

Many thanks for your efforts..

:D
John
User avatar
blueb
Addict
Addict
Posts: 1122
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

John,

As you can see: a small demo program (that works) is a great learning tool. And Danilo is the very best when it comes to freely giving out perfect demos.

Thanks Danilo 8) You're a very generous man.

I learn a lot from these forums. I've shamelessly copied a LOT of small demos. Keep it up guys, I hope to contribute more in the future.

blueb
johnfermor
User
User
Posts: 29
Joined: Wed Dec 31, 2003 3:17 pm

Post by johnfermor »

Thanks BlueB

I couldn't agree with you more. Its people like Danilo who make this forum what it is.
Post Reply