I ran into this while working on the "file-picker" vocabulary for 
cross-platform open and save dialogs. You can see how we did this for GTK:

https://github.com/slavapestov/factor/blob/master/extra/file-picker/linux/linux.factor

Basically, defined an alien function with the args we intended it to be called 
with, maybe a little annoying if you have a lot of variants of vararg arity, 
but worked for this case. 

Be good to hear if it works for you and, given the need for stack-checking, how 
we might improve this. 

Best,
John.


> On Apr 7, 2015, at 11:35 AM, Mark Green <m...@antelope.nildram.co.uk> wrote:
> 
> Hi,
> 
> I'm continuing my noodling with UIs using GTK but have hit a problem when 
> using GTK's dialog functions. They accept a final vararg parameter and I'm 
> not sure how to specify these when calling from Factor. To whit:
> 
> : s>gs ( string -- gstring ) utf8 string>alien ;
> 
> : main ( -- )
>   f f gtk_init
>   "Hello" s>gs f GTK_FILE_CHOOSER_ACTION_OPEN GTK_STOCK_CANCEL 
>  { GTK_RESPONSE_CANCEL GTK_STOCK_OPEN GTK_RESPONSE_ACCEPT f }
>      gtk_file_chooser_dialog_new gtk_dialog_run drop ;
> 
> If I try this, I get a message saying "generic word underlying>> is not 
> defined for string 'gtk-cancel'". I presume that at some point, 
> GTK_RESPONSE_CANCEL is getting expanded into Factor string "gtk-cancel". I 
> then tried to fix this by applying [ s>gs ] map to the list, but this also 
> doesn't work as I get an error saying that s>gs cannot be applied to the word 
> GTK_RESPONSE_CANCEL. So it seems that s>gs needs to be performed somewhere 
> during the expansion process, but isn't being. Plus, I don't even know if 
> this is the right syntax for a varargs call. Is there a standard for how to 
> do this?
> 
> Mark
> 
> 
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to