Axel Etzold
2006-Sep-22 20:17 UTC
[fxruby-users] A problem about updating an FXRuby program layout recursively
Dear all, I have a design question: assume we have an FXText field containing a sentence The <best> Ruby version is the current one. with "best" highlighted, and there is a choice of words | most wonderful |, | cutest |, | most effective | to replace "best". To do the replacement, I want to just click on any of three buttons. I want to iterate through all of the words of the sentence and I only know the choice of words for replacement at runtime. Now, if I click on the | most wonderful | - button, I want to have a sentence The most wonderful version of <Ruby> is the current one. i.e., "best" gets changed to "most wonderful", the next word Ruby gets highlighted, and there should be a choice of buttons of words replacing "Ruby", like | the computing language invented by Matz |, which should be shown instead of | most wonderful |, | cutest |, | most effective |. I have written a method with a lot of evals in it, which calls itself, when the user clicks on a button, and updates its arguments (move to the next word etc.) to do the trick of updating the buttons, but I can only show the first set of buttons and replace the first word - the new buttons for the next set of replacement words don''t appear. I rather randomly tried to call "app.update, app.recalc" etc., but none worked. What am I missing ? Thank you very much Best regards Axel -- NEU: GMX DSL Sofort-Start-Set - blitzschnell ins Internet! Echte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl
Lyle Johnson
2006-Sep-23 01:36 UTC
[fxruby-users] A problem about updating an FXRuby program layout recursively
On Sep 22, 2006, at 3:17 PM, Axel Etzold wrote:> I have written a method with a lot of evals in it, which calls > itself, when the user > clicks on a button, and updates its arguments (move to the next > word etc.) > to do the trick of updating the buttons, but I can only show the > first set of buttons and replace the first word - the new buttons > for the next set of replacement words don''t appear. > I rather randomly tried to call "app.update, app.recalc" etc., but > none worked. > > What am I missing ?Are you actually constructing a new FXButton each time? If so, you need to call create() on the button to realize it, e.g. new_button = FXButton.new(p, "Button Label", ...) new_buttton.create Note that a preferable approach (if I understand what you''re doing) is to just re-use the existing buttons, and change their label text, e.g. old_button.text = "New Label for an Old Button" Hope this helps, Lyle