1. Having trouble modifying tiny demo program
- Posted by vmars Jun 16, 2009
- 893 views
Trace shows that pgm runs fine. But doesn't give intended results [create( wxScrolledWindow doesn't show up].
Where can I go to find out what parameters are legal? When I search web for "create( wxScrolledWindow" + euphoria, I get nothing meaningful.
Thanks! ...Vern
include wxeud.e without warning with profile with trace trace(3) constant main = create( wxFrame, {0, -1, "TXTool", -1, -1, 400, 300} ), panl = create( wxPanel, main ), scrollwin = create( wxScrolledWindow, {panl, new_id(), "Red", 10, 10, 200, 200} ), -- scrollwin = create( wxScrolledWindow, {pnl, new_id(), -1, -1, -1, -1, 0} ), txted = create( wxTextCtrl, {panl, -1, "Enter Text Here", 10, 300, 200, 200} ), -- txted = create( wxTextCtrl, {panl, -1, "Enter Text Here", -1, -1} ), scrollbox = create( wxBoxSizer, {wxVERTICAL} ) -- testbutton = create( wxButton, {panl, -1,"Test Me"}), -- quitbutton = create( wxButton, {panl, -1, "Quit"}) set_sizer( scrollwin, scrollbox ) set_scrollbars( scrollwin, 0, 20, 0, 50, 0, 0, 0 ) set_back_color( scrollwin, create(wxColour, {#FF,#00,#00}) ) -- 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 )
2. Re: Having trouble modifying tiny demo program
- Posted by ghaberek (admin) Jun 16, 2009
- 907 views
Each control in the wxEuphoria docs should have its parameters listed. Anything with [=value] means that parameter is optional, and the value in brackets is the default. The version 13 docs are more comprehensive than the version 12 docs, as I painstakingly updated each control to list its required parameters in bold. Here are the parameters for wxScrolledWindow. As you can see, it does not take a "text" parameter, which you're feeding it...
Creation Parameters
- atom parent
- integer id [= -1]
- integer x [= -1]
- integer y [= -1]
- integer cx [= -1]
- integer cy [= -1]
- atom style [= wxHSCROL+wxVSCROLL]
- wxHSCROLL
- wxVSCROLL
-Greg
3. Re: Having trouble modifying tiny demo program
- Posted by ghaberek (admin) Jun 16, 2009
- 875 views
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 )