Re: Unified libraries to allow porting code to other oses
- Posted by irv May 25, 2015
- 2723 views
There are a few instances in GTK where something like that is done - where you wish to set a property of a 'child' of an object, when that child itself is generated internally as the result of creating the parent.
To do that, its necessary to call a Eu function which obtains the child and does the setting.
Using your example, and assuming the statusbar doesn't also have its own text which is settable:
{"text",{P,S},0,-routine_id("setStatusBarPanelText")} -- the prototype function setStatusBarPanelText(atom stbar, object txt) object panel = get(stbar,"child") set(panel,"text",txt) ....
Note that the routine_id for the function above has been negated. This makes it easy to differentiate positive numbers which are pointers to calls in the .dll, from negative numbers, which are calls to Euphoria routines, so you use c_func or call_func as appropriate.
Of course, there might be a situation where the statusbar has text, and its panel also has text, I suppose. In that case, just use a different name for one, such as statusbar caption. Or even something like:
{"panel.text",{P,S},-routine_id("setSbPanelTxt")}
Using that, your program could call:
set(panelbar,"panel.text","FooBar")
"panel->text" would work, or whatever you like, these are just strings.
set(panelbar,"panel->text->color","blue") if you want to look like some other programming language :)
{"cell_data",{P,I,I,S}} -- prototype for setting grid row, col, data Program code: set(grid,"cell_data",2,4,"Something or other")