* fhMessageBox(...) function in FH V7

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
User avatar
tatewise
Megastar
Posts: 27080
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

fhMessageBox(...) function in FH V7

Post by tatewise » 03 Mar 2022 12:53

Before FH V7 this function always displayed an icon as if the 3rd parameter defaulted to "MB_ICONEXCLAMATION".
In FH V7 if the 3rd parameter is omitted or is "" then no icon at all is displayed in the message box.
Does anyone else get the same effect?
Is this a fault or is it intended new behaviour that is simply not described in the Help page for fhMessageBox?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Mark1834
Megastar
Posts: 2147
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: fhMessageBox(...) function in FH V7

Post by Mark1834 » 03 Mar 2022 14:03

I hadn't realised that earlier versions of FH defaulted to an exclamation icon. IMO, the way FH7 behaves is much more logical and consistent with other apps, so I wouldn't describe it as a "fault".

I agree that the help documentation could be tidied up to make it clear that the parameter is optional and remove the old Family Historian 5 illustrations.
Mark Draper

User avatar
ColeValleyGirl
Megastar
Posts: 4853
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: fhMessageBox(...) function in FH V7

Post by ColeValleyGirl » 03 Mar 2022 14:17

strButton = fhMessageBox(strMessage[,strMessageBoxFormat[,strMessageBoxIcon[, hParentWnd]]])
[] denotes an optional parameter. Widely used in the Lua reference manual and other Lua programming resources. (It's part of the extended BNF notation often used to describe programming languages)

User avatar
Mark1834
Megastar
Posts: 2147
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: fhMessageBox(...) function in FH V7

Post by Mark1834 » 03 Mar 2022 15:18

Plugin help is generally specific that a parameter is optional though, rather than relying on an obscure convention that many readers will not be familiar with. Even Mike didn’t pick that up!
Mark Draper

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

Re: fhMessageBox(...) function in FH V7

Post by tatewise » 03 Mar 2022 15:30

I am perfectly happy with the optional parameter convention. It is just that when not supplied the default has changed.
It means that any plugin updated from earlier FH versions needs the missing 3rd parameter to be specified to retain the icon.
Annoyingly, that means the 2nd parameter must also be specified even for the default value, i.e. empty string "".
Does this need to be mentioned in Writing and Maintaining Plugins Compatible with Versions 5, 6 & 7?

While discussing the Help page, there are several mistakes.

strMessageBoxIcon needs to say what happens if not supplied or an empty string ("") and that it is optional.

Remarks Example: needs the message box images updating without icons or the script needs correcting.

Is everyone happy I report those changes to CP?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Mark1834
Megastar
Posts: 2147
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: fhMessageBox(...) function in FH V7

Post by Mark1834 » 03 Mar 2022 15:57

It's only a problem for old plugins that relied on an illogical default not changing rather than specifying the exclamation explicitly, but it is a difference (as well as the first parameter being optional in FH6 but required in FH7, so fhMessageBox('') no longer works) so should be mentioned in the KB for completeness.
Mark Draper

User avatar
ColeValleyGirl
Megastar
Posts: 4853
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: fhMessageBox(...) function in FH V7

Post by ColeValleyGirl » 03 Mar 2022 15:57

Mark1834 wrote:
03 Mar 2022 15:18
Plugin help is generally specific that a parameter is optional though, rather than relying on an obscure convention that many readers will not be familiar with.
Unless they read the section labelled Function Index in the Plugin Help. :lol:
Optional parameters are shown in square brackets. Some functions have many optional parameters. For some functions, like fhNewItemPtr, all parameters are optional.
Mike, if you're happy with the convention for option parameters, why would you report that the help page doesn't say it's optional?

For the rest, I don't see that it matters whether we're happy that you report things you don't like. Just report them...

I strongly suspect however that you're the only person with the problem of maintaining compatibility between plugins for V5/6 and 7. Newcomers to writing plugins will only care about V7 -- so the documentation should be accurate for their benefit.

User avatar
ColeValleyGirl
Megastar
Posts: 4853
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: fhMessageBox(...) function in FH V7

Post by ColeValleyGirl » 03 Mar 2022 16:00

Mark1834 wrote:
03 Mar 2022 15:57
should be mentioned in the KB for completeness.
That KB article doesn't pretend to be complete, nor could it ever be.

User avatar
Mark1834
Megastar
Posts: 2147
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: fhMessageBox(...) function in FH V7

Post by Mark1834 » 03 Mar 2022 16:11

The KB article doesn't have a section on FH function changes as it's mainly concerned with Lua changes. Agree this change is probably too trivial to give it a section of its own, but if there are other changes with a wider impact it might be worth including in the future. Mind you, we're 18 months into most plugin authors getting their hands on FH7 and I think this is the first time a function change has been perceived as a problem, so it doesn't sound like it's a huge issue...
Mark Draper

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

Re: fhMessageBox(...) function in FH V7

Post by tatewise » 03 Mar 2022 17:12

ColeValleyGirl wrote:
03 Mar 2022 15:57
Mike, if you're happy with the convention for option parameters, why would you report that the help page doesn't say it's optional?

Newcomers to writing plugins will only care about V7 -- so the documentation should be accurate for their benefit.
Everywhere else the Help pages reiterate that a parameter is optional, perhaps to save the user having to refer back to the syntax, so why not here too?

The documentation is inaccurate for FH V7 as has been discussed earlier.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Mark1834
Megastar
Posts: 2147
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: fhMessageBox(...) function in FH V7

Post by Mark1834 » 03 Mar 2022 17:53

I would say “incomplete” rather than “inaccurate”, as the original claim that the new behaviour is not described is not the case, so yes, IMO, it’s worth suggesting to CP that they add a fuller description to the help narrative.

Whether the new behaviour is good or bad is subjective - it’s a breaking change, but it corrects an anomaly and improves the function in FH7 with minimal impact elsewhere.
Mark Draper

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

Re: fhMessageBox(...) function in FH V7

Post by tatewise » 03 Mar 2022 18:46

It is inaccurate because if you run the example script the displays are not like the images shown.
In other words, the images demonstrate what happens in FH V5 (and V6) with icons by default, so are inaccurate for V7.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply