Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wxWidgets in FB Help -> Sizers
#1
I can't seem to figure out how to get a sizer attached to a frame with wxWidgets. And should it be on the frame, or a panel? I understand that you don't use a sizer directly but one of its dervived classes. Hence I have been tring to get a boxsizer to work.

Anyone have a simple example they'd care to post?
Reply
#2
nope, i think wxsizers are about the only things that refuse to work, as far as i can tell. if you talk them into working tho, let me know!

i was trying to port http://neume.sourceforge.net/sizerdemo/ into working, it was the simplest usage i could find, maybe it'll help you

here's another link you might find useful: http://forum.qbasicnews.com/viewtopic.php?t=9085
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply
#3
well since i guess these aren't going to work until fb gets classes and thus the real wx stuff, this'll do in the meantime:

Code:
'$include: "wx-c/wx.bi"
#define wxCLOSE_BOX &h1000
#define FALSE 0
#define TRUE NOT(FALSE)
declare sub sizersub(byval event as long,byval iListener as long)
dim shared wx_app as wxapp ptr,wx_frame as wxframe ptr,test as wxbutton ptr,test2 as wxbutton ptr

sub App_OnInit ()
  
   wx_frame = wxFrame ()
   wxFrame_Create (wx_frame, 0, 1, "Welcome to WX-C", wxSize ( -1, -1), wxSize ( -1, -1), wxDEFAULT_FRAME_STYLE or wxCLOSE_BOX, "frame" )
  
   wxWindow_SetAutoLayout(wx_frame,TRUE)
   test=wxbutton()
   wxButton_Create(test,wx_frame,-1,"Load a file!",wxSize(-1,-1),wxSize(-1,-1),0,0,0)
   test2=wxbutton()
   wxButton_Create(test2,wx_frame,-1,"Load another file!",wxSize(-1,-1),wxSize(-1,-1),0,0,0)
   wxWindow_CenterOnScreen(wx_frame,wxBOTH)
   wxEvtHandler_proxy( wx_frame, @sizersub )
   wxEvtHandler_connect(wx_frame,wxEvent_EVT_SIZE(),1,-1,0)
   wxWindow_Show ( wx_frame, 1)
   wxapp_oninit(wx_app)
  
end sub

sub sizersub(byval event as long,byval iListener as long)
   dim as wxsize ptr size = wxSize(-1,-1), self = wxSize(-1,-1), self2 = wxSize(-1,-1)
   wxWindow_GetSize(wxWindow_GetParent(test),size)
   wxWindow_GetSize(test,self)
   wxWindow_GetSize(test2,self2)
   px=wxSize_GetWidth(size)
   py=wxSize_GetHeight(size)-30 'for the caption
   sx=wxSize_GetWidth(self)
   sy=wxSize_GetHeight(self)
   s2x=wxSize_GetWidth(self2)
   s2y=wxSize_GetHeight(self2)
   wxWindow_Move(test,int(px/2-sx/2),int(py/2-sy/2),-1)
   wxWindow_Move(test2,int(px/2-s2x/2),int(py/2-sy/2)+sy,-1)
end sub

sub App_OnExit()

   wxapp_onexit(wx_app)

end sub

' main code...

  wx_app = wxApp()
  wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit)
  wxApp_Run(0,0)

end

[edit] fixed a little bug, i guess wx takes its rounding very seriously
ttp://m0n573r.afraid.org/
Quote:quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side
...phear
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)