1. Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 04, 2009
- 1240 views
Ugh! I am having trouble visualizing sizers. Here's what I want to see:
vertically: 4 rows
row1: panel(top) , then Hsizer , then topbutton01 + (horizontally) topbutton02
row2: wxScrolledWindow , then Vsizer , then 6-rows by 8-cols of 8buttons
row3: panel(mid) , then Hsizer , then midbutton01 + (horizontally) midbutton02
row4: wsRichTextCtrl
I can't figure out what I am doing wrong. -Thanks! ...V
[include statements] include wxeud.e without warning
[constants] constant Red = create( wxColour, {#FF,#00,#00} )
[create the controls] constant main = create( wxFrame, {0, -1, "TXTool", -1, -1, 400, 500} ), panl = create( wxPanel, main ), panltop = create( wxPanel, panl ), topbutton01 = create( wxButton, {panltop, new_id(), "Push Me", -1, -1, 40, 60} ), topbutton02 = create( wxButton, {panltop, new_id(), "Push Me", -1, -1, 40, 60} ), scrollwin = create( wxScrolledWindow, {panl, new_id(), -1, -1, -1, -1, 0} ), panlmid = create( wxPanel, panl ), midbutton01 = create( wxButton, {panlmid, new_id(), "Push Me", -1, -1, 40, 60} ), midbutton02 = create( wxButton, {panlmid, new_id(), "Push Me", -1, -1, 40, 60} ), txted = create( wxRichTextCtrl, {panl, -1, "Enter Text Here", -1, -1, 399, 250} ), panlbox = create( wxBoxSizer, {wxVERTICAL} ), panlboxt = create( wxBoxSizer, {wxHORIZONTAL} ), panlboxm = create( wxBoxSizer, {wxHORIZONTAL} ), scrollbox = create( wxBoxSizer, {wxVERTICAL} ), button_grid = create( wxFlexGridSizer, { 6, 8, 5, 5 })
[event handlers and other code] add_window_to_sizer( panlboxt, topbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxt, topbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, txted, 0, wxGROW, 0 )
add_sizer_to_sizer( scrollbox, button_grid, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxt, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxm, 1, wxGROW, 0 )
http://wxeuphoria.sourceforge.net/sfdocs/CONTROL.html#SET_SIZE
set_scrollbars( scrollwin, 20, 20, 50, 50, 0, 0, 0 ) set_back_color( scrollwin, Red )
atom tempbtn for i = 1 to 6 do for j = 1 to 8 do tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %dx%d", i & j), 0, 0, 90, 60} ) add_window_to_sizer( button_grid, tempbtn, 1, wxGROW, 0 ) end for j end for i
set_sizer( panl, panlbox ) set_sizer( panltop, panlboxt ) set_sizer( panlmid, panlboxm ) set_sizer( scrollwin, scrollbox )
wxMain( main ) with help from: Geg, Matt
2. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 04, 2009
- 1213 views
OOPS! forgot eucode
-- eucode --[include statements] include wxeud.e without warning --[constants] constant Red = create( wxColour, {#FF,#00,#00} ) --[create the controls] constant main = create( wxFrame, {0, -1, "TXTool", -1, -1, 400, 500} ), panl = create( wxPanel, main ), panltop = create( wxPanel, panl ), topbutton01 = create( wxButton, {panltop, new_id(), "Push Me", -1, -1, 40, 60} ), topbutton02 = create( wxButton, {panltop, new_id(), "Push Me", -1, -1, 40, 60} ), scrollwin = create( wxScrolledWindow, {panl, new_id(), -1, -1, -1, -1, 0} ), panlmid = create( wxPanel, panl ), midbutton01 = create( wxButton, {panlmid, new_id(), "Push Me", -1, -1, 40, 60} ), midbutton02 = create( wxButton, {panlmid, new_id(), "Push Me", -1, -1, 40, 60} ), txted = create( wxRichTextCtrl, {panl, -1, "Enter Text Here", -1, -1, 399, 250} ), panlbox = create( wxBoxSizer, {wxVERTICAL} ), panlboxt = create( wxBoxSizer, {wxHORIZONTAL} ), panlboxm = create( wxBoxSizer, {wxHORIZONTAL} ), scrollbox = create( wxBoxSizer, {wxVERTICAL} ), button_grid = create( wxFlexGridSizer, { 6, 8, 5, 5 }) --[event handlers and other code] add_window_to_sizer( panlboxt, topbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxt, topbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, txted, 0, wxGROW, 0 ) add_sizer_to_sizer( scrollbox, button_grid, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxt, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxm, 1, wxGROW, 0 ) --http://wxeuphoria.sourceforge.net/sfdocs/CONTROL.html#SET_SIZE --set_size ( atom win, integer cx, integer cy ) --move ( atom win, integer x, integer y ) set_scrollbars( scrollwin, 20, 20, 50, 50, 0, 0, 0 ) set_back_color( scrollwin, Red ) atom tempbtn for i = 1 to 6 do for j = 1 to 8 do tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %dx%d", i & j), 0, 0, 90, 60} ) add_window_to_sizer( button_grid, tempbtn, 1, wxGROW, 0 ) end for --j end for --i set_sizer( panl, panlbox ) set_sizer( panltop, panlboxt ) set_sizer( panlmid, panlboxm ) set_sizer( scrollwin, scrollbox ) wxMain( main ) --Geg, Matt
3. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 04, 2009
- 1213 views
Ok, I got it somewhat (see below), but I can't seem to get row-1 and row-3 to be the size I want it. So I'll mess with set_size. Ideally, What I want is
row-1 height = 50
row-2 height = 200
row-3 hekght = 50
row-4 height = 200
Any tips will be greatly app...
Thanks! ...V
--[include statements] include wxeud.e without warning --[constants] constant Red = create( wxColour, {#FF,#00,#00} ) --[create the controls] constant main = create( wxFrame, {0, -1, "TXTool", -1, -1, 500, 500} ), panl = create( wxPanel, main ), panltop = create( wxPanel, panl ), --{ panl, -1, "topPanll", -1, -1, -1, 30} ), topbutton01 = create( wxButton, {panltop, new_id(), "Push Me", -1, -1, -1, -1} ), topbutton02 = create( wxButton, {panltop, new_id(), "Push Me", -1, -1, -1, -1} ), scrollwin = create( wxScrolledWindow, {panl, new_id(), -1, -1, -1, 399, 150} ), panlmid = create( wxPanel, panl ), midbutton01 = create( wxButton, {panlmid, new_id(), "Push Me", -1, -1, 90, 10} ), midbutton02 = create( wxButton, {panlmid, new_id(), "Push Me", -1, -1, 90, 30} ), txted = create( wxRichTextCtrl, {panl, -1, "Enter Text Here", -1, -1, 399, 150} ), panlbox = create( wxBoxSizer, {wxVERTICAL} ), panlboxt = create( wxBoxSizer, {wxHORIZONTAL} ), panlboxm = create( wxBoxSizer, {wxHORIZONTAL} ), scrollbox = create( wxBoxSizer, {wxVERTICAL} ), button_grid = create( wxFlexGridSizer, { 6, 8, 5, 5 }) --[event handlers and other code] add_window_to_sizer( panlboxt, topbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxt, topbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, panltop, 1, wxGROW, 0 ) add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 ) add_window_to_sizer( panlbox, panlmid, 1, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, txted, 0, wxGROW, 0 ) add_sizer_to_sizer( scrollbox, button_grid, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxt, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxm, 1, wxGROW, 0 ) --http://wxeuphoria.sourceforge.net/sfdocs/CONTROL.html#SET_SIZE --set_size ( atom win, integer cx, integer cy ) --move ( atom win, integer x, integer y ) set_scrollbars( scrollwin, 20, 20, 50, 50, 0, 0, 0 ) set_back_color( scrollwin, Red ) atom tempbtn for i = 1 to 6 do for j = 1 to 8 do tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %dx%d", i & j), 0, 0, 90, 60} ) add_window_to_sizer( button_grid, tempbtn, 1, wxGROW, 0 ) end for --j end for --i set_sizer( panl, panlbox ) set_sizer( panltop, panlboxt ) set_sizer( panlmid, panlboxm ) set_sizer( scrollwin, scrollbox ) wxMain( main ) --Geg, Matt
4. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 04, 2009
- 1192 views
- Last edited Jul 05, 2009
I have been working for 12hrs straight on this crazy thing.
I have made some headway, not with set_size (see code), not with setting size in CREATE either.
Setting Width seems to work. But Height of Controls doesn't want to work.
The only luck i have with setting Height is in add_window_to_sizer. If I use ALIGN , specifically, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP). Then I can get topbutton01 and topbutton02 to park at TOP, but wxALIGN_LEFT & wxALIGN_RIGHT , don't do anything.
Also,
set_size( panl, 500,500 )
set_size( panltop, -1, 20 )
set_size( topbutton01, 200, 20 )
don't seem to work at all.
I didn't try to ALIGN midbutton01 & 02 , just to show the diff between using ALIGN and not using it.
I could sure use some expertise on my ALIGNment of Controls.
Thanks! ...V
--[include statements] include wxeud.e without warning --[constants] constant Red = create( wxColour, {#FF,#00,#00} ) --[create the controls] constant main = create( wxFrame, {0, -1, "TXTool", -1, -1, 501, 501} ), panl = create( wxPanel, main ), panltop = create( wxPanel, panl ), --{ panl, -1, "topPanl", -1, -1, -1, 21} ), topbutton01 = create( wxButton, {panltop, new_id(), "topbutton01", -1, -1, 201, 31} ), topbutton02 = create( wxButton, {panltop, new_id(), "topbutton02", -1, -1, 201, 31} ), scrollwin = create( wxScrolledWindow, {panl, new_id(), -1, -1, -1, 499, 149} ), panlmid = create( wxPanel, panl ), midbutton01 = create( wxButton, {panlmid, new_id(), "midbutton01", -1, -1, 201, 30} ), midbutton02 = create( wxButton, {panlmid, new_id(), "midbutton02", -1, -1, 201, 30} ), txted = create( wxRichTextCtrl, {panl, -1, "Enter Text Here", -1, -1, 499, 149} ), panlbox = create( wxBoxSizer, {wxVERTICAL} ), panlboxt = create( wxBoxSizer, {wxHORIZONTAL} ), panlboxm = create( wxBoxSizer, {wxHORIZONTAL} ), scrollbox = create( wxBoxSizer, {wxVERTICAL} ), button_grid = create( wxFlexGridSizer, { 6, 8, 5, 5 }) --[event handlers and other code] add_window_to_sizer( panlboxt, topbutton01, 0, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 ) add_window_to_sizer( panlboxt, topbutton02, 0, wx_or_all(wxALIGN_RIGHT & wxALIGN_TOP), 0 ) add_window_to_sizer( panlbox, panltop, 1, wxGROW, 0 ) add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 ) add_window_to_sizer( panlbox, panlmid, 1, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, txted, 0, wxGROW, 0 ) add_sizer_to_sizer( scrollbox, button_grid, 1, wxGROW, 0 ) add_sizer_to_sizer( panlbox, panlboxt, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 ) add_sizer_to_sizer( panlbox, panlboxm, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 ) --http://wxeuphoria.sourceforge.net/sfdocs/CONTROL.html#SET_SIZE --set_size ( atom win, integer cx, integer cy ) --move ( atom win, integer x, integer y ) set_scrollbars( scrollwin, 20, 20, 50, 50, 0, 0, 0 ) set_back_color( scrollwin, Red ) atom tempbtn for i = 1 to 6 do for j = 1 to 8 do tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %dx%d", i & j), 0, 0, 90, 60} ) add_window_to_sizer( button_grid, tempbtn, 1, wxGROW, 0 ) end for --j end for --i set_sizer( panl, panlbox ) set_sizer( panltop, panlboxt ) set_sizer( panlmid, panlboxm ) set_sizer( scrollwin, scrollbox ) --First, set the window to anything but what you ultimately want: --frameWin = create(wxFrame,{0,1,PROGRAM_TITLE,-1,-1,901,601}), -- off by 1 --Then, do this: set_size( main, 500,500 ) -- set to what you really want set_size( panl, 500,500 ) set_size( panltop, -1, 20 ) set_size( topbutton01, 200, 20 ) set_size( topbutton02, 200, 20 ) --set_size( scrollwin, 500, 150 ) --set_size( midbutton01, 30, 50 ) --set_size( midbutton02, 30, 50 ) --set_size( panlmid, 30, -1 ) --set_size( main, 500,500 ) wxMain( main ) --Thanks for your help!
5. Re: Ugh! I am having trouble visualizing sizers.
- Posted by mattlewis (admin) Jul 05, 2009
- 1191 views
Ok, I got it somewhat (see below), but I can't seem to get row-1 and row-3 to be the size I want it. So I'll mess with set_size. Ideally, What I want is
row-1 height = 50
row-2 height = 200
row-3 hekght = 50
row-4 height = 200
I think the problem is that you're passing a 1 for the third parameter (option) when adding everything. If you don't want the item to grow when the sizer does, pass 0.
Matt
6. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 05, 2009
- 1185 views
Ok, I got it somewhat (see below), but I can't seem to get row-1 and row-3 to be the size I want it. So I'll mess with set_size. Ideally, What I want is
row-1 height = 50
row-2 height = 200
row-3 hekght = 50
row-4 height = 200
I think the problem is that you're passing a 1 for the third parameter (option) when adding everything. If you don't want the item to grow when the sizer does, pass 0.
Matt
OK, by changing to:
add_window_to_sizer( panlbox, panltop, 0, wxGROW, 0 )
add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 )
add_window_to_sizer( panlbox, panlmid, 0, wxGROW, 0 )
panltop and panlmid HEIGHT work fine. NO luck yet with ALIGN_LEFT or ALIGN-LEFT. AND I still can't control the height of scrollwin.
If scrollwin is ,,0 then I loose topbuttons and midbuttons visability.
Either way, if I manually stretch/change(hold down left mousebtn and drag edge of form) the form vertically, top and mid buttons disappear. Their panels are still there, but buttons are gone.
However, when I manually stretch/change the form horizontally, left or right, the buttons re-appear. There's that problem.
Then there's this: I can control the height of txted. But scrollwin remains incorrigible, can't yet change its height.
Stranger than fiction.
Thanks! ...V
btw: What's the best way to visualize sizers:
A sizer controls the THING(control) that sits directly on top of the sizer. Is this correct?
7. Re: Ugh! I am having trouble visualizing sizers.
- Posted by mattlewis (admin) Jul 05, 2009
- 1208 views
btw: What's the best way to visualize sizers:
A sizer controls the THING(control) that sits directly on top of the sizer. Is this correct?
I mostly think of them like rubber bands that get stretched.
Matt
8. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 05, 2009
- 1184 views
- Last edited Jul 06, 2009
Yes, I see what you mean by 'like rubberbands'.
I have never seen a diagram of Sizers.
And I am trying to get an accurate visual of Sizers and how they fit together with other controls.
So, if I liken controls to a stack pancakes,
with wxFrame as the bottom pancake, and say the red pancakes are sizers and the non-red ones are other controls.
What I'd like to get confirmation on, is the positional characteristics of a sizer.
Ie., A sizer controls the THING(control) that sits directly on top of it, (Add_window_to_sizer).
And a sizer itself, sets upon the THING (control) that it is working for, as in (set_sizer)command.
So my friend, is my visual accurate. Or have I gotten it wrong?
Thanks! ...V
9. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 05, 2009
- 1176 views
- Last edited Jul 06, 2009
BTW: I have made some headway on my (guess I could say 'our') pgm.
The main prob was with these two statements:
add_sizer_to_sizer( panlbox, panlboxt, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 )
add_sizer_to_sizer( panlbox, panlboxm, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 )
Not sure why, but they cause the pgm to go Krazy.
Anyways, most things are solved, except for Positioning top & mid buttons.
What I want to do is put button 1&3 on left side, and button 2&4 on right side of parent panel.
Any tips are greatly appr...
Thanks! ...V
--[include statements] include wxeud.e without warning --[constants] constant Red = create( wxColour, {#FF,#00,#00} ) --[create the controls] constant main = create( wxFrame, {0, -1, "TXTool", -1, -1, 501, 501} ), panl = create( wxPanel, main ), panltop = create( wxPanel, panl ), --{ panl, -1, "topPanl", -1, -1, -1, 21} ), topbutton01 = create( wxButton, {panltop, new_id(), "topbutton01", -1, -1, 201, 31} ), topbutton02 = create( wxButton, {panltop, new_id(), "topbutton02", -1, -1, 201, 31} ), scrollwin = create( wxScrolledWindow, {panl, new_id(), -1, -1, -1, 499, 119} ), panlmid = create( wxPanel, panl ), midbutton01 = create( wxButton, {panlmid, new_id(), "midbutton01", -1, -1, 201, 31} ), midbutton02 = create( wxButton, {panlmid, new_id(), "midbutton02", -1, -1, 201, 31} ), txted = create( wxRichTextCtrl, {panl, new_id(), "Enter Text Here", -1, -1, 501, 249} ), --[and create these Sizer Controls] panlbox = create( wxBoxSizer, {wxVERTICAL} ), panlboxt = create( wxBoxSizer, {wxHORIZONTAL} ), panlboxm = create( wxBoxSizer, {wxHORIZONTAL} ), scrollbox = create( wxBoxSizer, {wxVERTICAL} ), button_grid = create( wxFlexGridSizer, { 6, 8, 5, 5 }) --[end of create controls] --[this Window sets upon this SIZER] add_window_to_sizer( panlboxt, topbutton01, 0, wxSHAPED, 0 ) add_window_to_sizer( panlboxt, topbutton02, 0, wxSHAPED, 0 ) add_window_to_sizer( panlbox, panltop, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 ) add_window_to_sizer( panlbox, panlmid, 0, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton01, 0, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton02, 0, wxGROW, 0 ) add_window_to_sizer( panlbox, txted, 0, wxGROW, 0 ) --[this SIZER sets upon this SIZER] add_sizer_to_sizer( scrollbox, button_grid, 1, wxGROW, 0 ) --add_sizer_to_sizer( panlbox, panlboxt, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 ) --add_sizer_to_sizer( panlbox, panlboxm, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 ) --http://wxeuphoria.sourceforge.net/sfdocs/CONTROL.html#SET_SIZE --set_size ( atom win, integer cx, integer cy ) --move ( atom win, integer x, integer y ) --[] --[event handlers and other code] set_scrollbars( scrollwin, 20, 20, 50, 50, 0, 0, 0 ) set_back_color( scrollwin, Red ) atom tempbtn for i = 1 to 6 do for j = 1 to 8 do --90,60 tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %dx%d", i & j), 0, 0, 100, 30} ) add_window_to_sizer( button_grid, tempbtn, 1, wxGROW, 0 ) end for --j end for --i --[this Sizer sets upon this Window] set_sizer( panl, panlbox ) set_sizer( panltop, panlboxt ) set_sizer( panlmid, panlboxm ) set_sizer( scrollwin, scrollbox ) --First, set the window to anything but what you ultimately want: --frameWin = create(wxFrame,{0,1,PROGRAM_TITLE,-1,-1,901,601}), -- off by 1 --Then, do this: set_size( main, 500,500 ) -- set to what you really want set_size( panl, 500,500 ) set_size( panltop, -1, 20 ) set_size( topbutton01, 200, 20 ) set_size( topbutton02, 200, 20 ) --set_size( scrollwin, 500, 150 ) set_size( midbutton01, 30, 50 ) set_size( midbutton02, 30, 50 ) set_size( panlmid, 30, -1 ) set_size( main, 500,500 ) wxMain( main ) --Thanks for your help!
10. Re: Ugh! I am having trouble visualizing sizers.
- Posted by mattlewis (admin) Jul 06, 2009
- 1219 views
BTW: I have made some headway on my (guess I could say 'our') pgm.
The main prob was with these two statements:
add_sizer_to_sizer( panlbox, panlboxt, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 )
add_sizer_to_sizer( panlbox, panlboxm, 1, wx_or_all(wxALIGN_LEFT & wxALIGN_TOP), 0 )
Not sure why, but they cause the pgm to go Krazy.
Anyways, most things are solved, except for Positioning top & mid buttons.
What I want to do is put button 1&3 on left side, and button 2&4 on right side of parent panel.
Any tips are greatly appr...
Thanks! ...V
You need to use space_sizer() to have blank space take up any slack between the buttons:
--[this Window sets upon this SIZER] add_window_to_sizer( panlboxt, topbutton01, 0, wxSHAPED, 0 ) space_sizer( panlboxt, 0, 0, 1, wxGROW, 0 ) add_window_to_sizer( panlboxt, topbutton02, 0, wxSHAPED, 0 ) add_window_to_sizer( panlboxm, midbutton01, 0, wxGROW, 0 ) space_sizer( panlboxm, 0, 0, 1, wxGROW, 0 ) add_window_to_sizer( panlboxm, midbutton02, 0, wxGROW, 0 )
Matt
11. Re: Ugh! I am having trouble visualizing sizers.
- Posted by mattlewis (admin) Jul 06, 2009
- 1183 views
Yes, I see what you mean by 'like rubberbands'.
I have never seen a diagram of Sizers.
And I am trying to get an accurate visual of Sizers and how they fit together with other controls.
So, if I liken controls to a stack pancakes,
with wxFrame as the bottom pancake, and say the red pancakes are sizers and the non-red ones are other controls.
What I'd like to get confirmation on, is the positional characteristics of a sizer.
Ie., A sizer controls the THING(control) that sits directly on top of it, (Add_window_to_sizer).
And a sizer itself, sets upon the THING (control) that it is working for, as in (set_sizer)command.
So my friend, is my visual accurate. Or have I gotten it wrong?
Yep, that's correct. A sizer makes sure that everything inside of the sizer (sizers and other controls) change their size and position when the 'parent' of the sizer changes its size or shape.
Matt
12. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 06, 2009
- 1159 views
Yes, I see what you mean by 'like rubberbands'.
I have never seen a diagram of Sizers.
And I am trying to get an accurate visual of Sizers and how they fit together with other controls.
So, if I liken controls to a stack pancakes,
with wxFrame as the bottom pancake, and say the red pancakes are sizers and the non-red ones are other controls.
What I'd like to get confirmation on, is the positional characteristics of a sizer.
Ie., A sizer controls the THING(control) that sits directly on top of it, (Add_window_to_sizer).
And a sizer itself, sets upon the THING (control) that it is working for, as in (set_sizer)command.
So my friend, is my visual accurate. Or have I gotten it wrong?
Yep, that's correct. A sizer makes sure that everything inside of the sizer (sizers and other controls) change their size and position when the 'parent' of the sizer changes its size or shape.
Matt
Ah yes, 'rubberbands and pancakes'. Sounds like a Disney movie.
Thanks for that definition Matt. That helps a great deal; I have given up my 'pancakes' in favor of your rubberband 'inside of', a rubberband frame inside of a parent frame. Nice to have a verbal to go along with a visual.
Thanks! ...V .
13. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 06, 2009
- 1169 views
Ah, I just noticed your 'space_sizer()' reply.
Works great, Thanks! ...V
14. Re: Ugh! I am having trouble visualizing sizers.
- Posted by CraigWelch Jul 07, 2009
- 1200 views
Chapter 7 of Cross-Platform GUI Programming with wxWidgets has some pretty good diagrams and explanations of sizers.
15. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 07, 2009
- 1198 views
Ugh! I thought I had mastered sizers and off to my next challenge, FONTs.
But not quite, I am hung up on making horizontal unstretchable.
Why would we want the Buttons to be unstretchable?
I would want the Buttons to stretch Horizontaly, if I dragged the Frame Horizontally.
Can someone explain this? Thanks! ...V
Please, see: Figure 7-8 A simple dialog using sizers
at (btw: Thanks for this link. I downloaded it.)
http://dev.gentoo.org/dberkholz/articles/programming_with_wxwidgets.pdf
\\-- A dialog with a stretching text control \\MyDialog::MyDialog(**wx**Window *parent, **wx**WindowID id, \\const **wx**String &title ) \\: **wx**Dialog(parent, id, title, \\**wx**DefaultPosition, **wx**DefaultSize, \\**wx**DEFAULT_DIALOG_STYLE | **wx**RESIZE_BORDER) \\{ \\**wx**BoxSizer *topSizer = new **wx**BoxSizer( **wx**VERTICAL ); \\-- Create text ctrl with minimal size 100x60 \\topSizer->Add( \\new **wx**TextCtrl( this, **wx**ID_ANY, “My text.â€, \\**wx**DefaultPosition, **wx**Size(100,60), **wx**TE_MULTILINE), \\1, -- make vertically stretchable \\**wx**EXPAND| -- make horizontally stretchable \\**wx**ALL, -- and make border all around \\10 ); -- set border width to 10 \\**wx**BoxSizer *buttonSizer = new **wx**BoxSizer( **wx**HORIZONTAL ); \\buttonSizer->Add( \\new **wx**Button( this, **wx**ID_OK, “OK†), \\0, -- make horizontally **unstretchable** \\ \\**wx**ALL, -- make border all around: implicit top alignment \\10 ); -- set border width to 10 \\buttonSizer->Add( \\new **wx**Button( this, **wx**ID_CANCEL, “Cancel†), \\0, -- make horizontally **unstretchable** \\**wx**ALL, -- make border all around (implicit top alignment) \\10 ); -- set border width to 10 \\topSizer->Add( \\buttonSizer, \\0, -- make vertically **unstretchable** \\**wx**ALIGN_CENTER ); -- no border and centre horizontally \\SetSizer( topSizer ); -- use the sizer for layout \\topSizer->Fit( this ); -- fit the dialog to the content \\SetSizer( topSizer ); // use the sizer for layout \\topSizer->Fit( this ); // fit the dialog to the content
16. Re: Ugh! I am having trouble visualizing sizers.
- Posted by ghaberek (admin) Jul 07, 2009
- 1161 views
Just put 1 in place of the 0 where it says "make horizontally unstretchable".
What exactly are you trying to do with fonts?
-Greg
17. Re: Ugh! I am having trouble visualizing sizers.
- Posted by mattlewis (admin) Jul 07, 2009
- 1157 views
Ugh! I thought I had mastered sizers and off to my next challenge, FONTs.
But not quite, I am hung up on making horizontal unstretchable.
Why would we want the Buttons to be unstretchable?
I would want the Buttons to stretch Horizontaly, if I dragged the Frame Horizontally.
Can someone explain this? Thanks! ...V
Most buttons do not stretch. For instance, the Preview and Post buttons here on the forum. I usually put buttons into sizers for positioning. It's only for things like edit areas that I want to stretch.
Matt
18. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 07, 2009
- 1155 views
What exactly are you trying to do with fonts? -Greg
FONTs:
I plan to use fonts 1stly for an array of Buttons,
-- eucode atom tempbtn for i = 1 to 6 do for j = 1 to 8 do tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %dx%d", i & j), 0, 0, 90, 60} ) add_window_to_sizer( button_grid, tempbtn, 1, wxGROW, 0 ) end for --j end for --i
and secondly, for :
txted = create( wxRichTextCtrl, {panl, -1, "Enter Text Here", -1, -1, 399, 250} )
In wxEuphoria, will we eventually move toward txted.font.style type of format.?
Thanks! ...Vern
19. Re: Ugh! I am having trouble visualizing sizers.
- Posted by mattlewis (admin) Jul 07, 2009
- 1173 views
In wxEuphoria, will we eventually move toward txted.font.style type of format.?
I don't know what that means.
Matt
20. Re: Ugh! I am having trouble visualizing sizers.
- Posted by vmars Jul 07, 2009
- 1160 views
- Last edited Jul 08, 2009
In wxEuphoria, will we eventually move toward txted.font.style type of format.?
I don't know what that means.
Matt
-- In wxEuphoria: txted = create( wxRichTextCtrl, {panl, -1, "Enter Text Here", -1, -1, 399, 250} )
In Delphi/pascal, a similar RichEdit Control definition looks lik this:
object txted: TRichEdit Left = 14 -- These are properties of object txted: TRichEdit Top = 296 Width = 675 Height = 265 Hint = ' Sorted text saved on ClipBoard and SortedLinesOut.txt file' Color = 48690940 Font.Charset = DEFAULT_CHARSET Font.Color = 41972491 Font.Height = -13 Font.Name = 'MS Sans Serif' Font.Style = [] HideSelection = False HideScrollBars = False ParentFont = False ParentShowHint = False PlainText = True ScrollBars = ssBoth -- To Reference a property of 'object txted: TRichEdit' -- all I need to do is this: \\ txted.font.style := something; \\ or \\ txted.font.color := someColor procedure TForm1.OpenPanelClick(Sender: TObject); begin if OpenDialog1.Execute then begin txtInFileName := OpenDialog1.FileName; FileNameLabel.Caption := txtInFileName; txted.Lines.CLEAR; txted.Lines.LoadFromFile(txtInFileName); -- Load txted with text txted.Visible := True; PrepWordsCount(txted); -- SaveAsDialog.FileName := txtInFileName; ForceCurrentDirecotry end else txtInFileName := ' '; end;
The problem I have with Delphi/Pascal is that their executables are very Large. Tripple true for Pascal crossplatform. Guess I am old-school.
...V
21. Re: Ugh! I am having trouble visualizing sizers.
- Posted by ghaberek (admin) Jul 08, 2009
- 1165 views
What you're describing is dot notation, an inherent feature of object-oriented programming. Euphoria is not object-oriented, and does not have that form of syntax. Similar features can be had with Euphoria's namespace feature, which I believe Matt is planning to add into wxEuphoria for the next major release. (Though I could be wrong on that.)
Here's an example of how I understand it would work...
// wxWidgets C++ code #include <wx/frame.h> wxFrame * frame = new wxFrame( parent, id, title, pos, size, style ); wxToolBar * toolbar = frame->CreateToolBar( style );
-- wxEuphoria code include wxFrame.e as wxFrame atom frame = wxFrame:Create( parent, id, title, pos, size, style ) atom toolbar = wxFrame:CreateToolBar( frame, style );
As you can see, such methods would make for almost line-to-line conversion of C wxWidgets programs.
-Greg