* Option buttons in Plug-in

Homeless Posts from the old forum system
Locked
avatar
dickthomas
Silver
Posts: 9
Joined: 16 Nov 2002 13:23
Family Historian: None

Option buttons in Plug-in

Post by dickthomas » 22 Apr 2012 19:39

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

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Option buttons in Plug-in

Post by tatewise » 22 Apr 2012 20:11

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,

avatar
dickthomas
Silver
Posts: 9
Joined: 16 Nov 2002 13:23
Family Historian: None

Option buttons in Plug-in

Post by dickthomas » 23 Apr 2012 09:43

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

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Option buttons in Plug-in

Post by tatewise » 23 Apr 2012 11:55

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.

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Option buttons in Plug-in

Post by Jane » 23 Apr 2012 12:52

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]

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Option buttons in Plug-in

Post by tatewise » 23 Apr 2012 14:09

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.

avatar
dickthomas
Silver
Posts: 9
Joined: 16 Nov 2002 13:23
Family Historian: None

Option buttons in Plug-in

Post by dickthomas » 23 Apr 2012 15:33

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

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Option buttons in Plug-in

Post by Jane » 23 Apr 2012 15:53

Just change hbox for for vbox to list them other other way.

avatar
dickthomas
Silver
Posts: 9
Joined: 16 Nov 2002 13:23
Family Historian: None

Option buttons in Plug-in

Post by dickthomas » 23 Apr 2012 16:12

Brilliant - whole thing is beginning to look good and do the job.

Cheers,
Dick

Locked