IUP/Layout/IupRadio: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
No edit summary
No edit summary
Line 16: Line 16:


===Examples===
===Examples===
<source lang=lua>
-- IupRadio Example in IupLua
-- Creates a dialog for the user to select his/her gender.
-- In this case, the radio element is essential to prevent the user from
-- selecting both options.


iupradio.gif (2892 bytes)
male = iup.toggle{title="Male"}
female = iup.toggle{title="Female"}
exclusive = iup.radio
{
  iup.vbox
  {
    male,
    female
  };
  value=female,
  tip="Two state button - Exclusive - RADIO"
}
 
frame = iup.frame{exclusive; title="Gender"}
 
dialog = iup.dialog
{
  iup.hbox
  {
    iup.fill{},
    frame,
    iup.fill{}
  };
  title="IupRadio",
  size=140,
  resize="NO",
  minbox="NO",
  maxbox="NO"
}
 
dialog:show()
</source>

Revision as of 07:24, 9 May 2023


Creates the radio element for grouping mutual exclusive toggles. Only one of its descendet toggles will be active at a time. The toggles can be at any composion.

Creation

iup.radio{element: ihandle} -> (elem: ihandle)
element: Identifier of an interface element. Usually it is a vbox or an hbox containing the toggles associated to the radio.
This function returns the identifier of the created radio, or nil if an error occurs.

Attributes

VALUE: Identifier of the active toggle.

Examples

<source lang=lua> -- IupRadio Example in IupLua -- Creates a dialog for the user to select his/her gender. -- In this case, the radio element is essential to prevent the user from -- selecting both options.

male = iup.toggle{title="Male"} female = iup.toggle{title="Female"} exclusive = iup.radio {

 iup.vbox
 {
   male,
   female
 };
 value=female,
 tip="Two state button - Exclusive - RADIO"

}

frame = iup.frame{exclusive; title="Gender"}

dialog = iup.dialog {

 iup.hbox
 {
   iup.fill{},
   frame,
   iup.fill{}
 };
 title="IupRadio",
 size=140,
 resize="NO",
 minbox="NO",
 maxbox="NO"

}

dialog:show() </source>