Thread: [Fxruby-users] Usage FXList : makeItemVisible
Status: Inactive
Brought to you by:
lyle
From: SIMOKAWA h. <h-s...@aa...> - 2003-10-21 06:58:40
|
Hello all, I am trying to do something with FxRuby, but it is not working for me. I want to scroll to bring a item into view, but I cannot it. Below is my code. Thanks for the help in advance SIMOKAWA, hajime (male,japan) require 'fox' include Fox class ListTestWindow < FXMainWindow def initialize(app) super(app, "fxtest", nil, nil, DECOR_ALL, 0, 0, 100, 100) @lst = FXList.new(self,4,nil,0,LIST_NORMAL |LAYOUT_FILL_X) @lst.appendItem '0' @lst.appendItem '1' @lst.appendItem '2' @lst.appendItem '3' @lst.appendItem '4' @lst.appendItem '5' @lst.appendItem '6' @lst.appendItem '7' @lst.appendItem '8' @lst.appendItem '9' @lst.makeItemVisible 7 end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 app = FXApp.new("FoxTest", "FoxTest") ListTestWindow.new(app) app.create app.run end |
From: Dalibor S. <da...@in...> - 2003-10-21 08:12:56
|
Hi. The method makeItemVisible takes a tree item as the argument - not the item index. Try replacing your code with: item7 = @lst.appendItem '7' @lst.appendItem '8' @lst.appendItem '9' @lst.makeItemVisible item7 Regards, Dalibor -- Dalibor Sramek http://www.insula.cz/dali | In the eyes of cats, dal...@in... | all things belong to cats. Quoting SIMOKAWA hajime <h-s...@aa...>: > Hello all, > > I am trying to do something with FxRuby, but it is not working for me. > I want to scroll to bring a item into view, but I cannot it. > Below is my code. > > Thanks for the help in advance > > SIMOKAWA, hajime (male,japan) > > > > require 'fox' > include Fox > > class ListTestWindow < FXMainWindow > def initialize(app) > super(app, "fxtest", nil, nil, DECOR_ALL, 0, 0, 100, 100) > > @lst = FXList.new(self,4,nil,0,LIST_NORMAL |LAYOUT_FILL_X) > @lst.appendItem '0' > @lst.appendItem '1' > @lst.appendItem '2' > @lst.appendItem '3' > @lst.appendItem '4' > @lst.appendItem '5' > @lst.appendItem '6' > @lst.appendItem '7' > @lst.appendItem '8' > @lst.appendItem '9' > > @lst.makeItemVisible 7 > > end > > def create > super > show(PLACEMENT_SCREEN) > end > end > > if __FILE__ == $0 > app = FXApp.new("FoxTest", "FoxTest") > ListTestWindow.new(app) > app.create > app.run > end > > > > ------------------------------------------------------- > This SF.net email is sponsored by OSDN developer relations > Here's your chance to show off your extensive product knowledge > We want to know what you know. Tell us and you have a chance to win $100 > http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users > |
From: meinrad r. <mei...@gm...> - 2003-10-21 09:26:51
|
Dalibor Sramek wrote: > Hi. > > The method makeItemVisible takes a tree item as the argument - not the item > index. dalibor: where did you get this information? here is what the online documentation for FXList#makeItemVisible says ------------------------------------------------ makeItemVisible(index) Scroll to bring item into view. Raises IndexError if index is out of bounds. ----------------------------------------------- > Try replacing your code with: > > item7 = @lst.appendItem '7' > @lst.appendItem '8' > @lst.appendItem '9' > @lst.makeItemVisible item7 > > Regards, > > Dalibor -- henon > |
From: meinrad r. <mei...@gm...> - 2003-10-21 10:10:03
|
Dalibor Sramek wrote: > Hi. > > The method makeItemVisible takes a tree item as the argument - not the item > index. [...] ah, i see. you had treelist in mind. actually this is an inconsistency issue that should be addressed to lyle. FXTreeList#makeItemVisible(item) FXList#makeItemVisible(index) lyle: could it be implemented that makeItemVisible takes both an item or an index? > > Regards, > > Dalibor > - henon |
From: Lyle J. <jl...@cf...> - 2003-10-21 17:28:41
|
meinrad recheis wrote: > lyle: could it be implemented that makeItemVisible takes both an item or > an index? Yes, I think this kind of overloading makes sense for FXIconList and FXList. Not sure that it is really useful for FXTreeList since that's not a flat list. |
From: meinrad r. <mei...@gm...> - 2003-10-21 08:22:18
|
SIMOKAWA hajime wrote: > Hello all, > hi, > I am trying to do something with FxRuby, but it is not working for me. > I want to scroll to bring a item into view, but I cannot it. > Below is my code. the line @lst.makeItemVisible 7 works well for me when inserted after show(PLACEMENT_SCREEN) obviously this can only be used after creation of the list. > > Thanks for the help in advance > > SIMOKAWA, hajime (male,japan) > regards, -- henon > > > require 'fox' > include Fox > > class ListTestWindow < FXMainWindow > def initialize(app) > super(app, "fxtest", nil, nil, DECOR_ALL, 0, 0, 100, 100) > > @lst = FXList.new(self,4,nil,0,LIST_NORMAL |LAYOUT_FILL_X) > @lst.appendItem '0' > @lst.appendItem '1' > @lst.appendItem '2' > @lst.appendItem '3' > @lst.appendItem '4' > @lst.appendItem '5' > @lst.appendItem '6' > @lst.appendItem '7' > @lst.appendItem '8' > @lst.appendItem '9' > > @lst.makeItemVisible 7 > > end > > def create > super > show(PLACEMENT_SCREEN) @lst.makeItemVisible 7 > end > end > > if __FILE__ == $0 > app = FXApp.new("FoxTest", "FoxTest") > ListTestWindow.new(app) > app.create > app.run > end > > |
From: SIMOKAWA h. <h-s...@aa...> - 2003-10-22 16:59:25
|
Hello all. Thanks for Dalibor Sramek and meinrad recheis. I have confirmed that the 'makeItemVisible' works after 'show'. Another Question: The 'makeItemVisible' is not working just after 'clearItems'. A 'create' is need before 'makeItemVisible'. But when not just after, the 'create' is needless. Below is my code. If you delete line#2, btnV9 is not work. If you delete line#1 and #2, btnV9 is work after pushing btnUp. Thanks for the help in advance SIMOKAWA, hajime (male,japan) require 'fox' include Fox class ListTestWindow < FXMainWindow def initialize(app) super(app, "fxtest", nil, nil, DECOR_ALL, 0, 0, 100) @btnV0 = FXButton.new(self,'visible 0',nil,nil,0,BUTTON_NORMAL |LAYOUT_FILL_X) @lst = FXList.new(self,4,nil,0,LIST_NORMAL |LAYOUT_FILL_X) @btnV9 = FXButton.new(self,'visible 9',nil,nil,0,BUTTON_NORMAL |LAYOUT_FILL_X) @btnUp = FXButton.new(self,'update',nil,nil,0,BUTTON_NORMAL |LAYOUT_FILL_X) self.update_list @btnV0.connect(SEL_COMMAND){ @lst.makeItemVisible 0 } @btnV9.connect(SEL_COMMAND){ update_list #1 when 'update' put here, create #2 'create' must be after update @lst.makeItemVisible 9 } @btnUp.connect(SEL_COMMAND){ update_list; #3 'create' is needless } end def update_list @lst.clearItems @lst.appendItem '0' @lst.appendItem '1' @lst.appendItem '2' @lst.appendItem '3' @lst.appendItem '4' @lst.appendItem '5' @lst.appendItem '6' @lst.appendItem '7' @lst.appendItem '8' @lst.appendItem '9' end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 app = FXApp.new("FoxTest", "FoxTest") ListTestWindow.new(app) app.create app.run end |
From: Lyle J. <jl...@cf...> - 2003-10-22 20:59:15
|
SIMOKAWA hajime wrote: > Another Question: > The 'makeItemVisible' is not working just after 'clearItems'. > A 'create' is need before 'makeItemVisible'. When you call clearItems() and, subsequently appendItem(), on the list, the list's layout is marked as dirty but it is not immediately reconciled. FOX uses a technique of delayed layout, which is described on this page from the FOX documentation: http://www.fox-toolkit.org/guiupdate.html Under normal circumstances, the GUI layout will not actually be reconciled until we return to the main FOX event loop, i.e. until we exit the callback for @btnV9. The problem in your case is that makeItemVisible() assumes that the list's layout has already been reconciled, which it hasn't. So the solution is to do *something* to force the layout to be reconciled immediately, before the call to makeItemVisible(). Calling create() on the main window is one way to do this, but the more proper way is to call the FXApp#forceRefesh method: @btnV9.connect(SEL_COMMAND) { update_list app.forceRefresh # reconcile layout immediately! @lst.makeItemVisible 9 } > But when not just after, the 'create' is needless. Correct. In this case, the calls to clearItems() and appendItem() in @btnUp's callback: @btnUp.connect(SEL_COMMAND) { update_list } Mark the list's layout as dirty, and shortly after we re-enter FOX's main event loop, the GUI layout is reconciled. Now any subsequent call to makeItemVisible() will work properly. Hope this helps, Lyle |
From: SIMOKAWA h. <h-s...@aa...> - 2003-10-23 06:32:59
|
Hello all, and thanks for all. I understand and the 'makeItemVisible' is working very well. Lyle Johnson <jl...@cf...> wrote: > SIMOKAWA hajime wrote: > > > Another Question: > > The 'makeItemVisible' is not working just after 'clearItems'. > > A 'create' is need before 'makeItemVisible'. > > When you call clearItems() and, subsequently appendItem(), on the list, > the list's layout is marked as dirty but it is not immediately > reconciled. FOX uses a technique of delayed layout, which is described > on this page from the FOX documentation: > > http://www.fox-toolkit.org/guiupdate.html > > Under normal circumstances, the GUI layout will not actually be > reconciled until we return to the main FOX event loop, i.e. until we > exit the callback for @btnV9. The problem in your case is that > makeItemVisible() assumes that the list's layout has already been > reconciled, which it hasn't. So the solution is to do *something* to > force the layout to be reconciled immediately, before the call to > makeItemVisible(). Calling create() on the main window is one way to do > this, but the more proper way is to call the FXApp#forceRefesh method: > > @btnV9.connect(SEL_COMMAND) { > update_list > app.forceRefresh # reconcile layout immediately! > @lst.makeItemVisible 9 > } > > > But when not just after, the 'create' is needless. > > Correct. In this case, the calls to clearItems() and appendItem() in > @btnUp's callback: > > @btnUp.connect(SEL_COMMAND) { > update_list > } > > Mark the list's layout as dirty, and shortly after we re-enter FOX's > main event loop, the GUI layout is reconciled. Now any subsequent call > to makeItemVisible() will work properly. > > Hope this helps, > > Lyle > > > > ------------------------------------------------------- > This SF.net email is sponsored by OSDN developer relations > Here's your chance to show off your extensive product knowledge > We want to know what you know. Tell us and you have a chance to win $100 > http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54 > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users ┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏ 下川 肇 (しもかわ はじめ)mailto:h-simokawa@aandd.co.jp 株式会社 エー・アンド・デイ 設計開発本部 132課 住所 埼玉県北本市朝日1−243 (郵便番号 364−8585) 電話 048-593−1827(132課直通) FAX 048-593−1119 ┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏┏ |