* New Multifact plugin

Writing and using plugins for Version 5 and above.
User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 11:27

Another small change that I thought allowed larger names and facts without wrapping is below:
Line ~966 in local boxPeople replace hbox with vbox
Line ~1032 in return replace hbox with vbox
Yes, but as the main issue at present is keeping the height of the plugin within bounds, this doesn't help -- and probably isn't necessary as resizing the plugin window widthways will do the same job.
Line ~337 in MakeButton replace "10x2" with "10x0" so buttons same height as boxes.
Will be done in version 1.7 which I will upload to the store later today, after I've regression tested my other plugins. (Not expecting an issue but best to be safe).
Line ~1328 use dlgmain:showxy(iup.CENTERPARENT,8) to position dialogue near top so all the expanders can be opened without dialogue going off bottom of screen.
This actually makes things worse on screens below 864 high -- the action buttons vanish off the bottom. Without it, the title bar goes missing but the action buttons are visible.

User avatar
tatewise
Megastar
Posts: 16457
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: New Multifact plugin

Post by tatewise » 27 Jun 2019 12:02

In general, I agree.
Was trying to get around the catch-22 of users with small screens getting controls into view.
That is a height problem, and you are describing the position and width being upset.
However, when I tried it the position is NOT changed, only the width changes and that can easily be retained using:

Code: Select all

    function SetMinimumSize(dlg)
        local wide = dlg.rastersize:match("(%d+)x%d+")
        dlg.minsize = iup.NULL
        dlg.size = iup.NULL
        iup.Refresh(dlg)
        local size = dlg.naturalsize
        local high = size:match("%d+x(%d+)")
        dlg.rastersize = wide.."x"..high
        dlg.minsize = size
        iup.Refresh(dlg)
    end
With that, the window stays put, and just the height adjusts to minimum size depending on expanders.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 12:09

Mike,

With your suggestions, changing the state of an expander on a docked window undocks the window and changes position height and width -- any of which would be unacceptable without the user requesting them.

User avatar
tatewise
Megastar
Posts: 16457
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: New Multifact plugin

Post by tatewise » 27 Jun 2019 12:47

Sorry, I don't understand what you mean by a docked window.
Is that a Preferences setting I was unaware of?
Do you mean Aero Snap to edge/corner of screen?
If so, then in Windows 10, my Plugin window stays put and only its height changes.

Changing the Individual(s) and Fact(s) from hbox to vbox is a bit subtle.
By allowing the boxes to be wider, it is much less likely that Names or Facts will wrap onto two lines.
So the box can be shorter, say 3 lines, and still probably accommodate 3 Names or Facts without scrolling.
Whereas, with hbox the box may need to be 4 - 6 lines to accommodate 3 Names or Facts that wrap.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 13:06

Yes, in your terms Aero snap-- although docked is a more generic term.

The problem also exists if you have a monitor with 'windows display management settings' -- I can for example set my screen to have six windows in a grid -- or one full height window on one side and two half-height windows on the other or a plethora of other options.

The basic UX principle is: if somebody had adjusted a window to their preference (height, width, position) it SHOULD NOT CHANGE IN ANY CHARACTERISTIC unless the user changes it themselves.
Changing the Individual(s) and Fact(s) from hbox to vbox is a bit subtle.
By allowing the boxes to be wider, it is much less likely that Names or Facts will wrap onto two lines.
So the box can be shorter, say 3 lines, and still probably accommodate 3 Names or Facts without scrolling.
Whereas, with hbox the box may need to be 4 - 6 lines to accommodate 3 Names or Facts that wrap.
Just widen the plugin if stuff is wrapping -- it opens as narrow as possible and less than half a screen so widening it is not usually an issue.

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 13:40

I attach version 1.7 which will be uploaded to the Plugin store early next week unless anyone finds further problems.
Multifact.lua
(72.14 KiB) Downloaded 8 times

User avatar
tatewise
Megastar
Posts: 16457
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: New Multifact plugin

Post by tatewise » 27 Jun 2019 14:01

Wrong extension again :o try .fh_lua

As I said, if I Aero-snap the Plugin window in Windows 10, the resizing only adjusts the height; the position & width stay put.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 14:19

The extension thing drive me nuts -- if you use a decent Lua IDE, fh_lua isn't an option.... so I have to save the file with a different extension. Grrr.

Try this.
Multifact.fh_lua
(72.14 KiB) Downloaded 10 times

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 14:21

the resizing only adjusts the height; the position & width stay put.
You keep missing the point -- adjusting "only" the height isn't acceptable. It completely messes up a carefully constructed windows layout.

What happens (for example) if you snap the plugin top-right?

User avatar
tatewise
Megastar
Posts: 16457
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: New Multifact plugin

Post by tatewise » 27 Jun 2019 15:30

I can Aero-snap the Plugin window to any corner, or put it anywhere on screen and alter its width, then when its height is auto-adjusted the top-left & top-right corners of the window stay put (providing it is using the function SetMinimumSize(dlg) that I posted earlier today.
I don't see how moving the bottom edge of a window up/down significantly upsets a layout.
However, I accept that apparently some systems strangely and undesirably alter more than just the bottom edge.

Maybe a variant is to only adjust the height (or size), if the bottom of the Plugin window is off the bottom of the screen, or alternatively the height of the Plugin window is greater than the height of the screen.
Then the majority of users would be unaffected, and only those with small screens would gain the benefit of fitting the window onto screen possibly at the expense of losing the docking stability.

You are missing the point about the Individual(s) and Fact(s) boxes.
Yes, putting the button above increases height of dialogue by 1 line.
But the boxes can be reduced by at least 2 lines and still probably avoid wrapping, even with default window.
Thus the minimum height of the dialogue is reduced, which helps with small screens.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 27 Jun 2019 15:35

then when its height is adjusted the top-left & top-right corners of the window stay put
So, the height changes? That would break some working layouts.

I'm losing track of which changes I'm supposed to be evaluating. Set aside the vbox versus hbox debate for some boxes -- what code changes should I be testing in my set up? Based on the version I posted (which is an amalgam of my old 1.6 and the changes I already had in train).

User avatar
tatewise
Megastar
Posts: 16457
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: New Multifact plugin

Post by tatewise » 27 Jun 2019 15:58

I need a while to check, but I'm busy this evening.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
tatewise
Megastar
Posts: 16457
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: New Multifact plugin

Post by tatewise » 28 Jun 2019 14:05

I've reviewed the script and now only adjust the height of the Plugin window if its natural height is greater than the screen.

This mainly involves rewriting the function SetMinimumSize(dlg) at about line 486 as shown below.

Within function MakeExpander(...) at about line 516 insert:
e.action = function() SetMinimumSize(dlgmain) end

After dlgmain.close_cb = function() ... end at about line 1418 insert:
dlgmain.resize_cb = function(self) SetMinimumSize(self) end

Those ensure the Plugin window is reviewed whenever an expander is changed or the window is resized.

Code: Select all

    function SetMinimumSize(dlg)
        local _,_, height = stringx.partition(iup.GetGlobal("SCREENSIZE"),"x")
        local old_wide, _, old_high = stringx.partition(dlg.rastersize,"x")
        dlg.minsize = iup.NULL
        dlg.size = iup.NULL
        iup.Refresh(dlg)
        local new_size = dlg.rastersize
        local new_wide, _, new_high = stringx.partition(new_size,"x")
        if height < new_high then
            new_high = tostring(tonumber(height) + 10)
            dlg.rastersize = old_wide.."x"..new_high
            dlg.minsize    = new_wide.."x"..new_high
        else
            dlg.rastersize = old_wide.."x"..old_high
            dlg.minsize = new_size
        end
        iup.Refresh(dlg)
    end
So on large screens the Plugin window should never change at all, except that its minimum size is reset.

On small screens the Plugin window is reduced to the screen height, with position and width unaltered.
If necessary, closing some expanders should always reveal the Clear, Create Facts & Exit buttons.
I suspect the reduced font size for small screens can be increased from 8 point to 9 or 10 point and still be OK.

If the above changes still cause your Plugin window to be repositioned, resized, or undocked, then I admit defeat.
Something about your system configuration is different from mine, so very difficult to resolve.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 28 Jun 2019 15:35

Thanks MIke -- initial testing says that works but I need to test some more scenarios and the family are urging me out to sit in the garden... Tomorrow, then.

User avatar
Ron Melby
Superstar
Posts: 424
Joined: 15 Nov 2016 15:40
Family Historian: V6.2

Re: New Multifact plugin

Post by Ron Melby » 29 Jun 2019 06:39

ColeValleyGirl, you use ZEROBRANE right?
autoanalyzer = true
console.fontname = 'Courier New'
console.fontsize = 10
default.extension = 'lua'
filetree.showchanges = true

editor.autoreload = true
editor.fontname = 'Courier New'
editor.fontsize = 12
editor.specmap.fh_lua = 'lua'
editor.specmap.wlua = 'lua'

editor.tabwidth = 2
editor.smartindent = true
editor.indentguide = wxstc.wxSTC_IV_LOOKBOTH --prf
editor.wrapindentmode = wxstc.wxSTC_WRAPINDENT_INDENT --prf

thats my preferences, system...unless you do a lot of other lua, couldnt you change default.extension to fh? dont know what it would do with two dft.exts...
FH V.6.2.7 Win 7 64 bit

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 29 Jun 2019 07:12

Thanks, Ron.

I've dropped this into user.lua and it seems to have done the trick -- hasn't changed the default but added fh_lua

Code: Select all

local luaspec = ide.specs.lua
luaspec.exts[#luaspec.exts+1] = "fh_lua"

User avatar
ColeValleyGirl
Megastar
Posts: 1296
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: New Multifact plugin

Post by ColeValleyGirl » 29 Jun 2019 11:01

Mike, I've now had a chance to do some detailed testing and I spoke too soon.

Snag 1: on a large (3340x1440) screen the plugin overflows the bottom of the screen -- can be easily fixed by setting the start window position.

Snag 2: The plugin window flickers repeatedly when moved, resized or when an expander state is changed. This happens on two different PCs, but doesn't happen when your code is removed -- this is an accessibility issue, as well as being damned annoying.

As you've already noted, the plugin still resizes (enlarges when an expander is expanded) without user intervention on smaller screens -- I might be able to grit my teeth and live with that but the flickering is unacceptable.

Thank you for your help with this, but I think that at this point we both throw in the towel and spend our effort on something else.

Post Reply