Iuplua - Positioning component

Asked

Viewed 162 times

2

In Iuplua, how do I position a component indicating the X(horizontal position) and Y(vertical position)? I read in the documentation:

It will be changed During the layout computation, except when FLOATING=YES or when used Inside a Concrete container layout.

So I tried:

require "iuplua"
button = iup.button{title="button", floating="yes", position = "50,0"}
dlg = iup.dialog{title="test", size="QUARTERxQUARTER", button}

dlg:show()

iup.MainLoop()

But it doesn’t change anything.

inserir a descrição da imagem aqui

  • What would be "x w y"?

  • I corrected the question.

  • From what is written in the documentation you presented is not to do anything. Do you know English? Translating "It will be changed during layout computing, except for when FLOATING=YES or when used inside a concrete layout container.". see: http://webserver2.tecgraf.puc-rio.br/iup/en/attrib/iup_floating.html The problem is not precisely that you have used this attribute?

  • I’ve tried, with floating="no", and without adding the attribute, and it still doesn’t work.

2 answers

2

I got. To be able to position, I had to put the button inside a box (I used hbox), and set the button’s FLOATING attribute to "yes". Just follow the code:

require "iuplua"
button = iup.button{title="button", floating="yes", position = "50,0"}
dlg = iup.dialog{title="test", size="QUARTERxQUARTER", iup.hbox{button}}

dlg:show()

iup.MainLoop()

Stayed like this:
inserir a descrição da imagem aqui

  • I was going to comment on this too, I was reading the documentation and I saw that you need the container. Now you can choose your answer or that of the author of the library :)

2


The FLOATING is an attribute processed only by abstract layout boxes such as vbox and hbox. That’s why your code didn’t work. In your example, doing , iup.vbox{button}} starts to work.

If you want to make concrete layout with IUP then the best is to use the iup.cbox as container. In this case the example should be modified like this:

floating="yes", cx = 50} 

, iup.cbox{button}}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.