Page 1 of 1
Option buttons in Plug-in
Posted: 22 Apr 2012 19:39
by dickthomas
I am writing a plug-in that requires user to make a choice of one of 5 options. fhMessageBox works well for 3 options but no more than that. Ideally I would like a window to appear with the 5 options and for the user to choose by use of radio buttons. I have searched on Google for this in Lua but although there are clear references to this I am not at all clear how I would get them to work in a FH plug-in.
Has anybody got any ideas how to do this ?
Alternatively is there any way in which fhMessageBox can be expanded to have more than 3 options ?
Thanks
Cheers,
Dick Thomas
ID:6173
Option buttons in Plug-in
Posted: 22 Apr 2012 20:11
by tatewise
In the
Family Historian Plugin Help open the section
Introduction to Lua and then the
Create User Interfaces with IUP.
This offers
iup.GetParam that allows multiple options.
You can define up to three buttons as renamed versions of
OK,
Cancel, and
Help.
You can define as many radio button toggles as you like.
There are other options for choosing file paths, and entering text, etc.
The items in this section are
predefined IUP user interfaces.
The full
IUP definition that allows virtually any user interface to be defined is found via the
http://www.tecgraf.puc-rio.br/iup/ link.
However, this will require a great deal of time and effort to master.
Have look in other Plugins that have significant user interfaces for examples.
e.g.
Ancestral Sources Data Entry would be a good start for basic buttons, also
Map Life Facts and
Change any Fact Tag,
Option buttons in Plug-in
Posted: 23 Apr 2012 09:43
by dickthomas
Thanks Mike,
I'll give it a go. I don't know why I didn't see this when I was scanning through the help.
Kind regards,
Dick
Option buttons in Plug-in
Posted: 23 Apr 2012 11:55
by tatewise
I have written a function that replicates
iup.Alarm but allows up to
9 buttons.
This has been added to the
Plugin Code Snippets as
User Interface Buttons.
Option buttons in Plug-in
Posted: 23 Apr 2012 12:52
by Jane
Mike, I have posted a variation on your code as a separate snippet, which might contain a few tricks you have not found in Lua yet.
[wiki]plugins:code_snippets:user_interface_buttons[/wiki]
Option buttons in Plug-in
Posted: 23 Apr 2012 14:09
by tatewise
Thanks Jane, I had an inkling that something like that was possible, but wanted to create something quickly for Dick.
I have revised my Code Snippet and so perhaps V2 can vanish.
V1.1 includes a horizontal line separator and padding on the buttons like iup.Alarm.
Option buttons in Plug-in
Posted: 23 Apr 2012 15:33
by dickthomas
Thanks Mike and Jane,
I had just about got a solution with iup.getparam but it wasn't as neat as yours. The only advantage with mine was that the options were listed vertically rather than across the page making it rather easier to get the text in. I need a bit more practice in Lua !
Kind regards,
Dick
Option buttons in Plug-in
Posted: 23 Apr 2012 15:53
by Jane
Just change hbox for for vbox to list them other other way.
Option buttons in Plug-in
Posted: 23 Apr 2012 16:12
by dickthomas
Brilliant - whole thing is beginning to look good and do the job.
Cheers,
Dick