Re: Having trouble modifying tiny demo program

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

Also, I suggest not using static position information. Sizers are much more efficient. I've modified your code to add a sizer for the wxPanel, then add the wxScrolledWindow and wxTextCtrl into it.

Another thing is that any type of reusable graphics objects like colors, pens, or brushes, should be declared once and saved as a constant, rather than creating them over and over again.

include wxeud.e
without warning   
 
constant Red = create( wxColour, {#FF,#00,#00} ) 
   
constant    
    main        = create( wxFrame, {0, -1, "TXTool", -1, -1, 400, 300} ), 
    panl        = create( wxPanel, main ), 
    scrollwin   = create( wxScrolledWindow, {panl, new_id(), -1, -1, -1, -1, 0} ), 
    txted       = create( wxTextCtrl, {panl, -1, "Enter Text Here"} ), 
    panlbox     = create( wxBoxSizer, {wxVERTICAL} ), 
    scrollbox   = create( wxBoxSizer, {wxVERTICAL} ) 
 
add_window_to_sizer( panlbox, scrollwin, 1, wxGROW, 0 ) 
add_window_to_sizer( panlbox, txted, 0, wxGROW, 0 ) 
set_sizer( panl, panlbox ) 
 
set_sizer( scrollwin, scrollbox )   
set_scrollbars( scrollwin, 0, 20, 0, 50, 0, 0, 0 )   
set_back_color( scrollwin, Red )  
 
-- fill the window with some buttons   
atom tempbtn   
for i = 1 to 20 do   
    tempbtn = create( wxButton, {scrollwin, -1, sprintf("Button %d", i), 0, 0, 90, 60} )   
    add_window_to_sizer( scrollbox, tempbtn, 0, wxGROW, 0 )   
end for   
   
wxMain( main ) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu