Thanks – a second normalizer fixes it.

 

Helen

 

From: Antonio Scuri <[email protected]> 
Sent: 06 March 2019 18:06
To: IUP discussion list. <[email protected]>
Subject: Re: [Iup-users] Unexpected normalisation behaviour

 

  Hi,

 

  This is the result without the normalizer:

 



 

  Notice that the buttons does not have the same size, and the label is quite 
different.

 

  This is the result with the normalizer:

 



 

  Notice that all buttons have the same with, equal to the label, the largest 
control.

 

  The natural size of the list is larger than the text, so the second line gets 
misaligned because it has more space to expand both texts. I think a second 
normalizer could solve that. If this is the problem you are facing.

 

  So, it is working as expected. At least of the current IUP version 3.26

 

  A few comments:

 

--dlgmain.expand="YES" -- all the containers already have expand enabled

--dlgmain.expandchildren = "YES" -- this may not be what you want, 
expandchildren has different results according to the container where the 
children is inserted. this is not a dialog attribute and it will be propagated 
to all the vbox and hbox in the dialog. just checking if you are aware of that.

--iup.Destroy(norm) -- The normalizer can be called also when the dialog is 
resized and automatically destroyed. just add it to one of the boxes of the 
dialog.

 

Best,

Scuri

 

 

 

Em qua, 6 de mar de 2019 às 07:53, <[email protected] 
<mailto:[email protected]> > escreveu:

I’m trying to lay out a dialog and normalisation isn’t working the way I 
expect. I’m using a normaliser ‘norm’ for all buttons and labels, but they’re 
coming out different sizes in different parts of the dialog… Test code to 
demonstrate the problem below, cut down from a much larger dialog. Environment 
is Lua 5.1 on windows, iup 3.5 – I have no control over the lua or iup versions.

 

I suspect I’ve got a fundamental misunderstanding of how this is supposed to 
work.

 

Helen

 

require("iuplua") -- GUI

norm = iup.normalizer{}

function MakeButton(title)

    return iup.button{alignment="ALEFT",padding ="10x2",normalizergroup = norm, 
title = title}

end

function MakeList(values)

    local l = iup.list{sort="NO", dropdown="YES", 
expand="HORIZONTAL",visibleitems="5"}

    for i, v in ipairs(values) do

        l[tostring(i)]=v

    end     

    return l

end

function MakeText()

    return iup.text{visiblelines = "1", padding ="10x2", expand = "HORIZONTAL"}

end

function MakeLabel(title) 

    return iup.label{title = title, normalizergroup = norm}

end

 

function boxA()

    local tblAssessment = {"Unreliable", "Questionable", "Secondary Evidence", 
"Primary Evidence", "<clear assessment>" }

    return iup.expander{title="A", state = "OPEN", 

        iup.vbox{

            iup.hbox{

                iup.hbox{MakeButton("Date..."), MakeText(); alignment = 
"ACENTER"},

                iup.hbox{MakeLabel("Assessment"), MakeList(tblAssessment); 
alignment = "ACENTER"}

            }

        }

    }

end

 

function boxB()

    return iup.expander{title="B", state = "OPEN",

        iup.vbox{

            iup.hbox{

                iup.hbox{MakeButton("Date..."), MakeText(); alignment = 
"ACENTER"},

                iup.hbox{MakeButton("Age..."), MakeText(); alignment = 
"ACENTER"}

            }

        }

    }

end

 

dlgmain = iup.dialog{iup.vbox{boxA(),boxB()}}

dlgmain.title = "Test"

dlgmain.size="QUARTER"

dlgmain.expand="YES"

dlgmain.margin = "3x3"

dlgmain.cgap = "2"

dlgmain.expandchildren = "YES"

norm.normalize = "HORIZONTAL" iup.Destroy(norm)

dlgmain:show()

iup.MainLoop()

dlgmain:destroy()

_______________________________________________
Iup-users mailing list
[email protected] <mailto:[email protected]> 
https://lists.sourceforge.net/lists/listinfo/iup-users

_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to