Page 1 of 1

How to create a child window with PB syntax?

Posted: Wed Jun 18, 2003 3:26 pm
by Edwin Knoppert
The new flag does not let me create a child window but only set an owner base window.

How can i create a childwindow with PB syntax only?
(WS_CHILD/DS_CONTROL/WS_EX_CONTROLPARENT)

Re: How to create a child window with PB syntax?

Posted: Wed Jun 18, 2003 5:11 pm
by fsw
Edwin Knoppert wrote:The new flag does not let me create a child window but only set an owner base window.

How can i create a childwindow with PB syntax only?
(WS_CHILD/DS_CONTROL/WS_EX_CONTROLPARENT)
Try this:

Code: Select all

OpenWindow( 1,0,0,640,480,#PB_Window_SystemMenu," PureBasic" )

Child = OpenWindow( 2,0,0,320,240,#PB_Window_SystemMenu | #PB_Window_WindowCentered |#WS_CHILD | #DS_CONTROL," CLIENT: NO BUTTON IN TASKBAR ",WindowID(1) )
CreateGadgetList(WindowID(2))
ButtonGadget(1,10,10,100,25,"Test")

Repeat
  Event.l = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget
      MessageRequester("Event","Gadget #: " + Str(EventGadgetID()),0)
    Case #PB_Event_CloseWindow
      If EventWindowID() > 1 : CloseWindow(EventWindowID()) : EndIf
  EndSelect
Until Event = #PB_Event_CloseWindow And EventWindowID() = 1

End 
The only negative point I see is that the Childwindow is never active (Title bar always grey)
But the Gadgets on it work (as you can see)
8O

Posted: Wed Jun 18, 2003 5:24 pm
by Edwin Knoppert
Seems to work fine, i tried the WS_CHILD style but somehow it didn't work :)

Will investigate further..

Thanks,

Posted: Wed Jun 18, 2003 10:50 pm
by VPureBasic
Hi Edwin,

Did you already try the library I wrote about it? WindowEx...

Code: Select all

;   ------------------------------------
;
;   WindowEx Library Test
;   Written by Roger Beausoleil
;   Forum Nick VPureBasic
;   visionfx@satelcom.qc.ca
;
;   ------------------------------------

;   CHANGE AND READ WINDOW STYLES | EXSTYLES  

    #MouseLeftClick = 513

    OpenWindow( 0,0,0,640,480,#PB_Window_SystemMenu," VisionFX" )
    CreateGadgetList( WindowID(0) )  
    
    OpenWindow( 1,100,100,100,100,#PB_Window_Invisible,"" )
    
    SetWindowStyles( 1,#WS_DLGFRAME|#WS_CLIPSIBLINGS|#WS_CLIPCHILDREN|#WS_VISIBLE|#WS_CHILD, 0  ) 
    SetWindowParent( 1,0 )

    TextGadget  ( 0,10,10,200,20,"Here's your new window info:" )
    StringGadget( 1,10,30,200,20,Str( WindowStyles  ( 1 ) ) )
    StringGadget( 2,10,50,200,20,Str( WindowExStyles( 1 ) ) )
      
    Repeat
    Until WaitWindowEvent() = #MouseLeftClick
              
    End

You can find this library in Paul's Resources site.

Roger

Posted: Thu Jun 19, 2003 9:10 am
by Edwin Knoppert
Thanks,
I'm well aware of windows api tricks but i don't know the inside of the PB windows, therefore my asking.

Still wonders me how it is possible that PB let us allow to use winapi styles with his own.
To me that's very unclear and would like to see more info regarding this.

Maybe PB can spread his original window code how it uses their windows and controls.
Then we can adapt.
At the end it's the compiler what makes it important.

Posted: Thu Jun 19, 2003 1:48 pm
by Num3
Edwin Knoppert wrote:Thanks,

Still wonders me how it is possible that PB let us allow to use winapi styles with his own.
To me that's very unclear and would like to see more info regarding this.
Fred has included over 600 api calls into purebasic, so many are present just by typing the variable. Other like for instance Flat Button flag can be easly imported.

Posted: Thu Jun 19, 2003 1:53 pm
by Edwin Knoppert
Yes fine but i have no insight what i can intermix and not.
???