|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Dynamic creation of a tabbed book of tablesHi all,
So I'm trying to create a bunch of tabbed tables in a tabbook, but I don't know in advance how many I will need, the number will depend on some data being read in by the system. doing this: years_on_file.each do |year| @customs_summary_year_tab = FXTabItem.new(@customs_summary_tabbook, " #{year} ", :opts => TAB_TOP_NORMAL) @customs_summary_year_frame = FXHorizontalFrame.new(@customs_summary_tabbook, :opts => FRAME_THICK|FRAME_RAISED|FRAME_LINE) @customs_summary_table = FXTable.new(@customs_summary_year_frame, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL|TABLE_READONLY) @customs_summary_table.setTableSize(num_of_rows, num_of_cols) @customs_summary_table.rowHeaderWidth = $row_col_frame_size @customs_summary_table.columnHeaderHeight = $row_col_frame_size ... more code that goes on to fill data into each table... end will generate a number of tabs, but, of course, they all get filled with the identical data (that generated by the last iteration through the block). I'm thinking that myabe I need to somehow use some sort of dyanmic naming scheme for my tabs and tables, but I'm at a loss as to how to do that. Any suggestions? Thanks! _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: Dynamic creation of a tabbed book of tablesHmm, no, got that wrong, so this will create each of the tabbed tables, but the problem is that the instance variable names will be only associated with the last objects created, so there is no way to reference and update values in the earlier tables (without removing and recreating them of course).
I guess what I need is to be able to use some sort of hash of the object ids for the individual tabs and tables created? ummm maybe using something like eachChildRecursive to nab the object ids?
On Wed, Oct 7, 2009 at 5:56 PM, Eric Hutton <eric.hutton@...> wrote: Hi all, _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: Dynamic creation of a tabbed book of tablesMaybe just use instance_variable_set/instance_variable_get to set/get variables?
-- Matma Rex - http://matma-rex.prv.pl/ _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: Dynamic creation of a tabbed book of tablesOn Oct 8, 2009, at 10:43 AM, Eric Hutton wrote: > Hmm, no, got that wrong, so this will create each of the tabbed > tables, but the problem is that the instance variable names will be > only associated with the last objects created, so there is no way to > reference and update values in the earlier tables (without removing > and recreating them of course). > > I guess what I need is to be able to use some sort of hash of the > object ids for the individual tabs and tables created? ummm maybe > using something like eachChildRecursive to nab the object ids? Sorry for the delayed response, but I've been on vacation. Technically, you can always "get to" these widgets by navigating through the widget hierarchy using methods like FXWindow#each_child, but that can be a little tricky. Why don't you just store them in arrays or hashes, e.g. customs_summary_year_tabs = [] customs_summary_tables = [] years_on_file.each do |year| customs_summary_year_tabs << FXTabItem.new(...) ... customs_summary_year_tables << FXTable.new(...) end Hope this helps, Lyle _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
Re: Dynamic creation of a tabbed book of tablesNo need to apologize! No one expects you to be on call to answer questions 24/7, or even at all if you don't want to!
Putting them in a hash was exactly what I had in mind, but it didn't seem to be working for me so I wasn't sure if it was possible. I'll have to experiment with that a bit more. As a workaround I've been doing the thing you dislike - removing (using each_child, remove_child) and recreating, rather than redrawing. On Sat, Oct 10, 2009 at 11:11 AM, James Johnson <lyle@...> wrote:
_______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
| Free embeddable forum powered by Nabble | Forum Help |