Page 1 of 1

How to set focus of newly created record?

Posted: 17 Jan 2012 14:21
by TSG
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

How to set focus of newly created record?

Posted: 17 Jan 2012 14:37
by Jane
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.

How to set focus of newly created record?

Posted: 17 Jan 2012 14:49
by TSG
Could you explain further how I could do this pls?

How to set focus of newly created record?

Posted: 17 Jan 2012 14:54
by Jane
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

How to set focus of newly created record?

Posted: 17 Jan 2012 14:57
by TSG
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?

How to set focus of newly created record?

Posted: 17 Jan 2012 15:05
by Jane
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

How to set focus of newly created record?

Posted: 17 Jan 2012 15:22
by TSG
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.

How to set focus of newly created record?

Posted: 17 Jan 2012 15:32
by Jane
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.

How to set focus of newly created record?

Posted: 17 Jan 2012 15:57
by TSG
Finally got there! Thanks again :)