|
--++MultiLine.bach
A small example of The MULTILINE widget
++---------------------------------------------
include iupcore.b IupSetLanguage ("ENGLISH")
-- A MULTILINE widget MultiLine MLtext ("")-- no callback MLtext.set ("EXPAND=YES")
-- A TEXT widget for input-output TextBox TX_txt("") TX_txt.set ("EXPAND=HORIZONTAL")
-- A Button to append TEXT at the end of the MULTILINE global function CB_append (atom $self) sequence txt = TX_txt.get ("VALUE") MLtext.append (txt) return IUP.CONTINUE end function Button BT_append ("Append", "CB_append")
-- A button to insert TEXT into the MULTILINE Button BT_insert("Insert", "CB_insert") global function CB_insert (atom $self) sequence txt = TX_txt.get ("VALUE") MLtext.insert (txt) return IUP.CONTINUE end function
-- A button to clear the MULTILINE Button BT_clear("Clear", "CB_clear") global function CB_clear (atom $self) MLtext.set ("VALUE=") return IUP.CONTINUE end function
-- A button to get selected text from MULTILINE to TEXT Button BT_getsel ("GetSel", "CB_getsel") global function CB_getsel (atom $self) sequence txt = MLtext.get ("SELECTEDTEXT") TX_txt.set ("VALUE" & "=" & txt) return IUP.CONTINUE end function
-- Arrange the buttons horizontally HBox H1 ({0, BT_append, 0, BT_insert, 0, BT_clear, 0, BT_getsel, 0})
-- Combine MULTILINE, TEXT and buttons vertically VBox V1 ({MLtext, TX_txt, H1})
-- Define the Dialog Dialog D (V1) D.set ("TITLE = Dialogs, SIZE = QUARTERxQUARTER") -- force size
----- Show & go IupShowXY (D.handle, IUP.CENTER, IUP.CENTER ) IupMainLoop () IupClose ()
|