Well, I''m trying to put together a quick gui for a log analysis script I''m using and while I''ve got the basics working it just doesn''t look the way I want it to :). Being an absolute newbie in the subject of FOX and a relative stranger to GUI programming in general I need help badly. Now, my current problem is getting a FXList to start with a reasonable size. The following code does not do what I expect it to do (multiple select is not activated). #List for types theTypeList=FXList.new(topFrame,nil,LIST_MULTIPLESELECT) types.each{|t| theTypeList.appendItem(t) } Moreover I get only two visible items (there are more the 10) and a very narrow horizontal area (something like 5 characters wide). How do I control initial size for the widget? How to I make it resize together with the outer window? topFrame is a FXHorizontalFrame with default initialisation. I''d appreciate a few pointers to tutorials for Layouts and Layout hints if there are any out there. I''ve looked in FXruby.org and FOX Community, but there doesn''t seem to be much about the nitty gritty of layouts. Thanks for the help, Cheers, V.- ____________________________________________________________________ http://www.freemail.gr - ?????? ???????? ???????????? ????????????. http://www.freemail.gr - free email service for the Greek-speaking.
Damphyr schrieb:> Well, > I''m trying to put together a quick gui for a log analysis script I''m > using and while I''ve got the basics working it just doesn''t look the > way I want it to :). > Being an absolute newbie in the subject of FOX and a relative stranger > to GUI programming in general I need help badly. > Now, my current problem is getting a FXList to start with a reasonable > size. The following code does not do what I expect it to do (multiple > select is not activated). > > #List for types > theTypeList=FXList.new(topFrame,nil,LIST_MULTIPLESELECT) > types.each{|t| > theTypeList.appendItem(t) > } > > Moreover I get only two visible items (there are more the 10)Try: theTypeList.numVisible = types.size # or any integer value you''d like to use If you''re creating theTypeList at runtime you will have to call theTypeList.recalc afterwards.> and a very narrow horizontal area (something like 5 characters wide). > How do I control initial size for the widget? How to I make it resize > together with the outer window?Try adding LAYOUT_FILL_X and/or LAYOUT_FILL_Y as additional flags in the call of FXList.new (e.g. LIST_MULTIPLESELECT|LAYOUT_FILL_X).> topFrame is a FXHorizontalFrame with default initialisation. > I''d appreciate a few pointers to tutorials for Layouts and Layout > hints if there are any out there. I''ve looked in FXruby.org and FOX > Community, but there doesn''t seem to be much about the nitty gritty of > layouts.The best page for information about layout managers is this one (included in the FOX docs): http://fox-toolkit.org/layout.html - Jannis
Jannis Pohlmann wrote:> Damphyr schrieb: >> #List for types >> theTypeList=FXList.new(topFrame,nil,LIST_MULTIPLESELECT)First things first: the above line is wrong. theTypeList=FXList.new(topFrame,nil,0,LIST_MULTIPLESELECT) is the correct one (I was putting the options in place of the selection). That took care of the multiple selection problem. Further reading of the RDocs reveals snippets of information on the use of LAYOUT_FILL_X etc. These take care of the initial placement problem. Now, how do I influence which widgets are shown and which not? I guess I have to add a bit more code to the create method for the main window: def create super show(PLACEMENT_SCREEN) end # create> The best page for information about layout managers is this one > (included in the FOX docs): > http://fox-toolkit.org/layout.htmlThanks, I''ll keep reading :) Cheers, V.-
Hi again.> Now, how do I influence which widgets are shown and which not? > I guess I have to add a bit more code to the create method for the > main window: > > def create > super > show(PLACEMENT_SCREEN) > end # createYou''re right, if you want the main window to be shown, you have to call its #show method. For every other widget (original FOX or derived from a FOX widget) you won''t have to do anything special, they''re shown by default. If you create a widget during runtime (this means, elsewhere than in #initialize of its parent) you will have to call #create if you want it to be shown/created. If you want to hide a widget, simply call #hide. If you don''t want to do that every time but want a widget which is hidden by default, derive it from a FOX widget and add the call of #hide to its create method (same like you did with show(PLACEMENT_SCREEN) in your main window. That''s all. Hope this helps, Jannis