[fxruby-users] Dynamic creation of a tabbed book of tables

James Johnson lyle at lylejohnson.name
Sat Oct 10 11:11:29 EDT 2009


On 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


More information about the fxruby-users mailing list