How to create a child window with PB syntax?

Everything else that doesn't fall into one of the other PB categories.
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

How to create a child window with PB syntax?

Post 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)
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

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

Post 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

I am to provide the public with beneficial shocks.
Alfred Hitshock
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

Seems to work fine, i tried the WS_CHILD style but somehow it didn't work :)

Will investigate further..

Thanks,
VPureBasic
User
User
Posts: 59
Joined: Fri Apr 25, 2003 6:09 pm
Location: Quebec - Canada

Post 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
Everything is possible with PureBASIC... All you're missing is imagination!
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post 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.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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.
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

Yes fine but i have no insight what i can intermix and not.
???
Post Reply