Re: [Fxruby-users] Usage FXList : makeItemVisible
Status: Inactive
Brought to you by:
lyle
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 |