* How to set focus of newly created record?

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
TSG
Gold
Posts: 21
Joined: 07 Sep 2011 11:52
Family Historian: V6
Contact:

How to set focus of newly created record?

Post by TSG » 17 Jan 2012 14:21

I have just written my first LUA plugin to create a new Source record. Can anyone tell me how I can get FH to focus on the record I have just created? ie to bring up the properties window for the new record?

Many Thanks

ID:5819

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

How to set focus of newly created record?

Post by Jane » 17 Jan 2012 14:37

You can't control the Property box directly, but you can use the result set to return the record and then double click on it to edit it.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
TSG
Gold
Posts: 21
Joined: 07 Sep 2011 11:52
Family Historian: V6
Contact:

How to set focus of newly created record?

Post by TSG » 17 Jan 2012 14:49

Could you explain further how I could do this pls?

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

How to set focus of newly created record?

Post by Jane » 17 Jan 2012 14:54

In the help look at the following functions

fhOutputResultSetColumn
fhOutputResultSetTitles


You can then add your new source record pointer to a table using clone() and then use fhOutputResultSetColumn

When the plugin ends the result set will be displayed.

There is an example of the use in the help and you can see a full working example, in the Search and return result set plugin : Source Code for Search and Return
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
TSG
Gold
Posts: 21
Joined: 07 Sep 2011 11:52
Family Historian: V6
Contact:

How to set focus of newly created record?

Post by TSG » 17 Jan 2012 14:57

Many thanks for the help/links.

Its' rather an awful lot to code up just to point to a record ... is there any chance this could be included in the API since I suspect it would be useful in quite a few situations?

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

How to set focus of newly created record?

Post by Jane » 17 Jan 2012 15:05

It's only about 6 lines, plugins currently don't control the interface other that via the result set.

I suspect it won't make it in to 5, but agree a set Property Box on end of plugin might be useful on for the wish list once 5 is released.

Don't forget if you want to allow editing you could always add a iup window to maintain the fields you want to. This is what I do for the GRO plugin.

http://www.family-historian.co.uk/plugi ... try?id=138
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
TSG
Gold
Posts: 21
Joined: 07 Sep 2011 11:52
Family Historian: V6
Contact:

How to set focus of newly created record?

Post by TSG » 17 Jan 2012 15:22

Thanks again ... I am already using a iup window but really just wanted to exit back to FH (with the new record selected) once the record has been created. I could re-write the plug in to hold all the source info and hence not need the properties window but then I'd just be re-writing the existing FH functionality. .... Hmmmm will put my thinking hat on again.

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

How to set focus of newly created record?

Post by Jane » 17 Jan 2012 15:32

The results set window works pretty well and you only have to add the one line, and then click on it so it's not too tricky.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
TSG
Gold
Posts: 21
Joined: 07 Sep 2011 11:52
Family Historian: V6
Contact:

How to set focus of newly created record?

Post by TSG » 17 Jan 2012 15:57

Finally got there! Thanks again :)

Post Reply