Page 1 of 1

Example for Splitter, Always Subwin active and Window resize

Posted: Sat Jun 07, 2003 10:41 am
by GPI
Updated for version 5.20

resize.

In PB3.7, you must use the callback for the resize, because you get no "offical" message :(

Ok here it is. Also when you try to activate Window(0) "Hallo", always the subwindow(1) is activate.

Code: Select all


Procedure Callback(WindowID, Message, wParam, lParam) 
  Result = #PB_ProcessPureBasicEvents 
  Select message
    Case #WM_MOUSEACTIVATE
      If windowid=WindowID(0)
        result=#MA_NOACTIVATEANDEAT
        SetActiveWindow_(WindowID(1))
      EndIf
    Case #WM_ACTIVATE
      If IsWindow(0)
        If windowid=WindowID(0)
          type=lparam&$ffff
          If type=#WA_ACTIVE
            SetActiveWindow_(WindowID(1))
          EndIf
        EndIf
      EndIf
    Case #WM_SIZE
      If windowid=WindowID(1)
        ResizeGadget(6,-1,-1,WindowWidth(1),WindowHeight(1))
      EndIf
      
  EndSelect
  ProcedureReturn Result 
EndProcedure 
OpenWindow(3,400,200,400,400,"hallo3")
OpenWindow(0,0,200,400,400,"Hallo")
OpenWindow(1,200,200,400,400,"Hallo2",#PB_Window_SizeGadget|#PB_Window_SystemMenu,WindowID(0))

SetWindowCallback(@callback())


;ContainerGadget(1,0,0,400,200)



ButtonGadget(2,0,0,190,200,"Test1")
ButtonGadget(4,210,0,190,200,"test2")
SplitterGadget(3, 0,0, 400,200, 2,4,  #PB_Splitter_Vertical|#PB_Splitter_Separator   ) 
;CloseGadgetList()
ButtonGadget(5,0,200,400,200,"Test3")
SplitterGadget(6, 0,0,400,400, 3,5)

SetGadgetState(3,300)

Repeat
  event=WaitWindowEvent()
  Select event
    Case #PB_Event_CloseWindow
      End
  EndSelect
  
ForEver

Re: Example for Splitter, Always Subwin active and Window re

Posted: Sat Jun 07, 2003 11:12 am
by Berikco
GPI wrote:resize.

In PB3.7, you must use the callback for the resize, because you get no "offical" message :(
There is also no realtime message for WM_SIZE, or ScrollBar moved, this is a windows limitation.
For the TrackBar gadget, you get realtime messages, windows is realy wierd.

So only in a CallBack you get the messages, not with TranslateMessage(),Dispatchmessage() api.

Re: Example for Splitter, Always Subwin active and Window re

Posted: Sat Jun 07, 2003 7:55 pm
by fsw
Berikco wrote: So only in a CallBack you get the messages, not with TranslateMessage(),Dispatchmessage() api.
When I look at C code for Windows (or other languages as well) the
TranslateMessage(),Dispatchmessage() part of the code is only used to keep
the application alive.

The WndProc callback is always used for events.
Didn't know PureBasic does it different.

Interesting ....

:?