Re: Ugh! I am having trouble visualizing sizers.

new topic     » goto parent     » topic index » view thread      » older message » newer message

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! 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu