IUP extension and library

An extension and library for the IUP toolkit.

File:
iup.lib, iup_next.dll
Version:
1.0
Author:
Marcus Johansson

Contents

Details
Constants
Sub routines


Details

You can use this extension and library to access the IUP toolkit, which allows you to create programs with the native GUI. Look at the examples to get an idea of how things work. But to really understand IUP you should visit the official web site. This library was created by Marcus Johansson but documented by me, John Master. My knowledge about IUP is sadly not as good as Marcus's. But ... I did manage to write the entire NaaLaa editor using this library :)


Constants

Events

Name
Description
IUP_NO_EVENT
No event.
IUP_ACTION_EVENT
Action.
IUP_VALUECHANGED_EVENT
Value changed event.
IUP_CARET_EVENT
Caret event.
IUP_BUTTON_EVENT
Button event.
IUP_MOTION_EVENT
Motion event.
IUP_CLOSE_EVENT
Close event.
IUP_SPIN_EVENT
Spin event.
IUP_KEYPRESS_EVENT
Key press event.
IUP_TABCLOSE_EVENT
Tab close event.
IUP_TABCHANGE_EVENT
Tab change event.
IUP_KEY_EVENT
Key event.

Dialog positioning

Name
Description
IUP_CENTER
Center.
IUP_LEFT
Left.
IUP_RIGHT
Right position.
IUP_MOUSEPOS
Mouse position.
IUP_CURRENT
Current.
IUP_CENTERPARENT
Center parent.
IUP_TOP
Top.
IUP_BOTTOM
Bottom.

Key codes

Name
Description
K_SP
K_exclam
K_quotedbl
K_numbersign
K_dollar
K_percent
K_ampersand
K_apostrophe
K_parentleft
K_parentright
K_asterisk
K_plus
K_comma
K_minus
K_period
K_slash
K_0
K_1
K_2
K_3
K_4
K_5
K_6
K_7
K_8
K_9
K_colon
K_semicolon
K_less
K_equal
K_greater
K_question
K_at
K_A
K_B
K_C
K_D
K_E
K_F
K_G
K_H
K_I
K_J
K_K
K_L
K_M
K_N
K_O
K_P
K_Q
K_R
K_S
K_T
K_U
K_V
K_W
K_X
K_Y
K_Z
K_bracketleft
K_backslash
K_bracketright
K_circum
K_underscore
K_grave
K_a
K_b
K_c
K_d
K_e
K_f
K_g
K_h
K_i
K_j
K_k
K_l
K_m
K_n
K_o
K_p
K_q
K_r
K_s
K_t
K_u
K_v
K_w
K_x
K_y
K_z
K_braceleft
K_bar
K_braceright
K_tilde
K_BS
K_TAB
K_LF
K_CR
K_PAUSE
K_ESC
K_HOME
K_LEFT
K_UP
K_RIGHT
K_DOWN
K_PGUP
K_PGDN
K_END
K_MIDDLE
K_Print
K_INS
K_Menu
K_DEL
K_F1
K_F2
K_F3
K_F4
K_F5
K_F6
K_F7
K_F8
K_F9
K_F10
K_F11
K_F12
K_LSHIFT
K_RSHIFT
K_LCTRL
K_RCTRL
K_LALT
K_RALT
K_NUM
K_SCROLL
K_CAPS
K_ccedilla
K_Ccedilla
K_acute
K_diaeresis


Subroutines

Initialisation and event loop

Name
Parameters
Brief description
function
IupInit
hideNaaLaa
Initilise IUP.
procedure
IupMainLoop
Enter IUP main loop.
function
IupGetEvent?
waitForEvent
Get event.

Dialogs

Name
Parameters
Brief description
function
IupDialog
title$, contentHandle
Create dialog.
procedure
IupShow
handle
Show dialog.
procedure
IupShowXY
handle, x, y
Show dialog at position.
procedure
IupPopup
handle, x, y
Show modal dialog.
procedure
IupMessage
title$, msg$
Show message box.
function
IupAlarm
title$, msg$, b1$, b2$, b3$
Show alarm message box.
function
IupGetFile$
filename$
Show file dialog.
function
IupFileDlg
Create file dialog.
function
IupGetColor[]
x, y
Show color dialog.
function
IupGetText$
title$, text$
Show text dialog.

Controls

Name
Parameters
Brief description
function
IupButton
title$
Create button.
function
IupCloseButton
title$
Create close button.
function
IupLabel
title$
Create label.
function
IupFill
Create fill control.
function
IupImage
img
Create an image control.
function
IupNaaLaaImage
img, doScale
Create canvas.
function
IupText
numCols, numLines
Create text edit control.
procedure
IupDisableUndo
text
Disable undo.
procedure
IupEnableUndo
text
Enble undo.
procedure
IupFreeze
text
Freeze.
procedure
IupUnfreeze
text
Unfreeze.
function
IupCode
numCols, numLines, settings$
Create code edit control.
function
IupTabs
handles[]
Create tabs.
function
IupFrame
handle, title$
Create frame.
function
IupList
Create list.
function
IupListWithElements
elements$[], dropDown
Create list.
function
IupProgressBar
horizontal, dashed
Create progress bar.
function
IupVal
horizontal, value#, ticks
Create val control.
function
IupToggle
title$, state
Create toggle.
function
IupRadio
child
Create radio control.
function
IupScrollBox
child
Create scroll box.
procedure
IupRedraw
handle, updateChildren
Redraw a control.
procedure
IupDestroy
handle
Destroy control.
procedure
IupDetach
child
Detach child.
procedure
IupAppend
handle, child
Append.
procedure
IupMap
handle
Map.
procedure
IupRefresh
handle
Refresh.
procedure
IupSetFocus
handle
Set focus.
function
IupGetFocus
handle
Get handle to control with focus.
procedure
IupSetHandle
name$, handle
Set handle.
function
IupGetHandle
name$
Get handle.

Layout

Name
Parameters
Brief description
function
IupVBox
handles[]
Create VBox.
function
IupHBox
handles[]
Create HBox.
function
IupGridBox
handles[], horizontal, numDiv
Create GridBox.

Attributes

Name
Parameters
Brief description
procedure
IupSetAttribute
handle, name$, value$
Set attribute.
procedure
IupSetAttributeId
handle, name$, id, value$
Set attribute with id.
procedure
IupSetAttributes
handle, values$
Set attributes.
procedure
IupResetAttribute
handle, name$
Reset attribute.
function
IupGetAttribute$
handle, name$
Get attribute.
function
IupGetAttributeId$
handle, name$, id
Get attribute with id.
function
IupGetFloat#
handle, name$
Get float attribute.
function
IupGetFloatId#
handle, name$, id
Get float attribute.
function
IupGetFloatId2#
handle, name$, lin, col
Get float attribute.
function
IupGetInt
handle, name$
Get int attribute.
function
IupGetIntId
handle, name$, id
Get int attribute.
function
IupGetInt2
handle, name$
Get int attribute.
function
IupGetIntId2
handle, name$, lin, col
Get int attribute.
procedure
IupSetAttributeHandle
handle, name$, handle_named
Set attribute handle.
procedure
IupWriteAttributeToFile
handle, name$, filename$
Write attribute to file.
procedure
IupSetAttributeFromFile
handle, name$, filename$
Set attribute from file.

Event registering

Name
Parameters
Brief description
procedure
IupSetEvent
handle, event
Register event for control.
procedure
IupSetEvents
handle, events
Set events.

Menus

Name
Parameters
Brief description
function
IupItem
title$
Create item.
function
IupToggleItem
title$, state
Create toggle item.
function
IupCloseItem
title$
Create close item.
function
IupMenu
handles[]
Create menu.
function
IupSubmenu
title$, menu
Create sub menu.
function
IupSeparator
Create separator.
function
IupUser
Create user element.

Other

Name
Parameters
Brief description
function
IupCtrlPlus
key
Return keycode for IUP_KEY_EVENT with Ctrl+.


Subroutine documentation

function IupInit ( hideNaaLaa )

Initialise IUP and hide the NaaLaa window if 'hideNaaLaa' is set to true.

Parameter
Mode
Description
hideNaaLaa
In
Hide NaaLaa window.

Return value
True on success, else false.

[ Back ]


procedure IupMainLoop ( )

This will block the program until IUP closes. If you want to react on events from the user, you should never call this. See 'IupGetEvent' for more information.

[ Back ]


function IupGetEvent? ( waitForEvent )

In your program loop, you should call this function to get and react on events from IUP. The function returns the next event in the queue as an object. The 'event' field gives you the event type, such as IUP_ACTION_EVENT or IUP_VALUECHANGED_EVENT. If the field is IUP_NO_EVENT, there's no event in the queue. The 'handle' field is the handle of the control in which the event occured. If 'waitForEvent' is set to true, the program will wait for an event to occur.

Parameter
Mode
Description
waitForEvent
In
Wait for an event to occur.

Return value
The event as an object.

[ Back ]


function IupDialog ( title$, contentHandle )

Create a new dialog.

Parameter
Mode
Description
title
In
Dialog title.
contentHandle
In
Handle to dialog content.

Return value
Handle to dialog.

[ Back ]


procedure IupShow ( handle )

Parameter
Mode
Description
handle
In
Handle to dialog.

[ Back ]


procedure IupShowXY ( handle, x, y )

Show dialog at position 'x', 'y'.

Parameter
Mode
Description
handle
In
Handle to dialog.
x
In
X-coordinate.
y
In
Y-coordinate.

[ Back ]


procedure IupPopup ( handle, x, y )

Show a modal dialog at position 'x', 'y'. This dialog will keep focus until it's closed.

Parameter
Mode
Description
handle
In
Handle to dialog.
x
In
X-coordinate.
y
In
Y-coordinate.

[ Back ]


procedure IupMessage ( title$, msg$ )

Show a message box. Use 'chr$(13)' to cause line breaks in message.

Parameter
Mode
Description
title
In
Dialog title.
msg
In
Message.

[ Back ]


function IupAlarm ( title$, msg$, b1$, b2$, b3$ )

Show an alarm message box with up to three buttons. Use 'chr$(13)' for line breaks in message. Submit empty strings for 'b2' and/or 'b3' for a two or one button message box.

Parameter
Mode
Description
title
In
Dialog title.
msg
In
Message.
b1
In
Label for first button.
b2
In
Label for second button.
b3
In
Label for third button.

Return value
The id (1..3) of the button that the dialog was dismissed with.

[ Back ]


function IupGetFile$ ( filename$ )

Show a generic file dialog and return the filename. Use 'filename' to set default path and/or extension (like ".TXT").

Parameter
Mode
Description
filename
In
Path, filename and extension.

Return value
Selected filename, empty string if nothing was selected.

[ Back ]


function IupFileDlg ( )

See IUP docs for all settings and how to use this.

Return value

[ Back ]


function IupGetColor[] ( x, y )

Show a color dialog and return the selected color as an RGB array.

Parameter
Mode
Description
x
In
X-coordinate.
y
In
Y-coordinate.

Return value
Array containing the R, G and B values like [R, G, B].

[ Back ]


function IupGetText$ ( title$, text$ )

Show a text dialog and return the entered text string.

Parameter
Mode
Description
title
In
Title of dialog.
text
In
Default text.

Return value
The entered text.

[ Back ]


function IupButton ( title$ )

Create a button control.

Parameter
Mode
Description
title
In
Label of button.

Return value
Handle to control.

[ Back ]


function IupCloseButton ( title$ )

Create a close button control This control is NaaLaa specific and closes the window when pressed.

Parameter
Mode
Description
title
In
Label of button.

Return value
Handle to control.

[ Back ]


function IupLabel ( title$ )

Create a label control.

Parameter
Mode
Description
title
In
Label.

Return value
Handle to control.

[ Back ]


function IupFill ( )

Create a fill control.

Return value
Handle to control.

[ Back ]


function IupImage ( img )

Create a control to hold an image.

Parameter
Mode
Description
img
In
Image identifier.

Return value
Handle to control.

[ Back ]


function IupNaaLaaImage ( img, doScale )

This control is NaaLaa specific. It's a canvas connected to an image, that you can draw to directly from your program.

Parameter
Mode
Description
img
In
Image id.
doScale
In
Scale to fit.

Return value
Handle to control.

[ Back ]


function IupText ( numCols, numLines )

Create a single or multiline editable text control. Set 'numLines' to 1 for a single line control.

Parameter
Mode
Description
numCols
In
Number of columns.
numLines
In
Number of lines.

Return value
Handle to control.

[ Back ]


procedure IupDisableUndo ( text )

Hack to disable undo in text control.

Parameter
Mode
Description
text
In
Handle to text control.

[ Back ]


procedure IupEnableUndo ( text )

Hack to re-enable undo in text control.

Parameter
Mode
Description
text
In
Handle to text control.

[ Back ]


procedure IupFreeze ( text )

Hack to freeze text control.

Parameter
Mode
Description
text
In
Handle to text control.

[ Back ]


procedure IupUnfreeze ( text )

Hack to unfreeze text control.

Parameter
Mode
Description
text
In
Handle to text control.

[ Back ]


function IupCode ( numCols, numLines, settings$ )

Create a very basic code edit control.

Parameter
Mode
Description
numCols
In
Number of columns.
numLines
In
Number of lines
settings
In
Text file containting settings.

Return value

[ Back ]


function IupTabs ( handles[] )

Create tabs control for the controls in 'handles'.

Parameter
Mode
Description
handles
In
Handles to controls.

Return value
Handle to control.

[ Back ]


function IupFrame ( handle, title$ )

Create a frame for a control.

Parameter
Mode
Description
handle
In
Handle to control.
title
In
Title of frame.

Return value
Handle to control.

[ Back ]


function IupList ( )

Create a list control.

Return value
Handle to control.

[ Back ]


function IupListWithElements ( elements$[], dropDown )

Create and fill a list control.

Parameter
Mode
Description
elements
In
Elements of list.
dropDown
In
True for a drop down list.

Return value
Handle to control.

[ Back ]


function IupProgressBar ( horizontal, dashed )

Create a progress bar control.

Parameter
Mode
Description
horizontal
In
True for a horizontal bar.
dashed
In
True for a dashed progress bar.

Return value
Handle to control.

[ Back ]


function IupVal ( horizontal, value#, ticks )

Create a valuator control.

Parameter
Mode
Description
horizontal
In
True for a horizontal valuator control.
value
In
Default value.
ticks
In
Number of ticks.

Return value
Handle to control.

[ Back ]


function IupToggle ( title$, state )

Create a toggle control.

Parameter
Mode
Description
title
In
Label.
state
In
Default state (true/false or on/off).

Return value
Handle to control.

[ Back ]


function IupRadio ( child )

Create a radio control from child control.

Parameter
Mode
Description
child
In
Child control.

Return value
Handle to control.

[ Back ]


function IupScrollBox ( child )

Create a scroll box from child control.

Parameter
Mode
Description
child
In
Child control.

Return value
Handle to control.

[ Back ]


procedure IupRedraw ( handle, updateChildren )

Redraw control and its children if 'updateChildren' is true.

Parameter
Mode
Description
handle
In
Handle to control.
updateChildren
In
Update children.

[ Back ]


procedure IupDestroy ( handle )

Destroy a control.

Parameter
Mode
Description
handle
In
Handle to control.

[ Back ]


procedure IupDetach ( child )

Detach child control from its parent.

Parameter
Mode
Description
Handle
In
to child control.

[ Back ]


procedure IupAppend ( handle, child )

Append child to control.

Parameter
Mode
Description
handle
In
Handle to parent control.
child
In
Handle to child control.

[ Back ]


procedure IupMap ( handle )

Map native control to control. Needed if you add controls to already added containers.

Parameter
Mode
Description
handle
In
Handle to control.

[ Back ]


procedure IupRefresh ( handle )

Refresh control.

Parameter
Mode
Description
handle
In
Handle to control.

[ Back ]


procedure IupSetFocus ( handle )

Set focus to control.

Parameter
Mode
Description
handle
In
Handle to control.

[ Back ]


function IupGetFocus ( handle )

Return handle of the control that has focus.

Return value
Handle of control with focus.

[ Back ]


procedure IupSetHandle ( name$, handle )

Set handle.

Parameter
Mode
Description
name
In
Name.
handle
In
Handle.

[ Back ]


function IupGetHandle ( name$ )

Get handle.

Parameter
Mode
Description
name
In
Name.

Return value
Handle.

[ Back ]


function IupVBox ( handles[] )

Create a vertical container for the controls in 'handles'.

Parameter
Mode
Description
handles
In
Handles to controls.

Return value
Handle to control.

[ Back ]


function IupHBox ( handles[] )

Create a horizontal container for the controls in 'handles'.

Parameter
Mode
Description
handles
In
Handles to controls.

Return value
Handle to control.

[ Back ]


function IupGridBox ( handles[], horizontal, numDiv )

Create a GridBox container for the controls in 'handles'.

Parameter
Mode
Description
handles
In
Handles to controls.
horizontal
In
True for horizontal layout.
numDiv
In
Number of divisions.

Return value
Handle to control.

[ Back ]


procedure IupSetAttribute ( handle, name$, value$ )

Set an attribute for control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
value
In
value Value.

[ Back ]


procedure IupSetAttributeId ( handle, name$, id, value$ )

Set attribute with id.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
id
In
Id.
value
In
Value.

[ Back ]


procedure IupSetAttributes ( handle, values$ )

Set multiple attributes for control.

Parameter
Mode
Description
handle
In
Handle to control.
values
In
Values.

[ Back ]


procedure IupResetAttribute ( handle, name$ )

Reset an attribute for control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.

[ Back ]


function IupGetAttribute$ ( handle, name$ )

Get an attribute from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.

Return value
Value of attribute.

[ Back ]


function IupGetAttributeId$ ( handle, name$, id )

Get an attribute with id from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
id
In
Id.

Return value
Value of attribute.

[ Back ]


function IupGetFloat# ( handle, name$ )

Get a floating point attribute from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.

Return value
Value of attribute.

[ Back ]


function IupGetFloatId# ( handle, name$, id )

Get a floating point attribute with id from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
id
In
Id.

Return value
Value of attribute.

[ Back ]


function IupGetFloatId2# ( handle, name$, lin, col )

Get floating point attribute with name, line and column from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
lin
In
Line.
col
In
Column.

Return value
Value of attribute.

[ Back ]


function IupGetInt ( handle, name$ )

Get integer attribute from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.

Return value
Value of attribute.

[ Back ]


function IupGetIntId ( handle, name$, id )

Get integer attribute with id from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
id
In
Id.

Return value
Value of attribute.

[ Back ]


function IupGetInt2 ( handle, name$ )

Get second integer attribute with name from control

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.

Return value
Value of attribute.

[ Back ]


function IupGetIntId2 ( handle, name$, lin, col )

Get attribute with name, line and column from control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
lin
In
Line.
col
In
Column.

Return value
Value of attribute.

[ Back ]


procedure IupSetAttributeHandle ( handle, name$, handle_named )

Parameter
Mode
Description
handle
In
name
In
handle_named
In

[ Back ]


procedure IupWriteAttributeToFile ( handle, name$, filename$ )

Write an attribute to file. Good if you want to save the content of a text control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
filename
In
File name.

[ Back ]


procedure IupSetAttributeFromFile ( handle, name$, filename$ )

Read an attribute from file. Good if you want to load the content of a text control.

Parameter
Mode
Description
handle
In
Handle to control.
name
In
Name of attribute.
filename
In
File name.

[ Back ]


procedure IupSetEvent ( handle, event )

Register an event for control. Your program will be notified on the event for this control.

Parameter
Mode
Description
handle
In
Handle to control.
event
In
Event to register.

[ Back ]


procedure IupSetEvents ( handle, events )

Register several events for control. Your program will be notified on these events for this control.

Parameter
Mode
Description
handle
In
Handle to control.
events
In
Events to register.

[ Back ]


function IupItem ( title$ )

Create an item for menu.

Parameter
Mode
Description
title
In
Label.

Return value
Handle to control.

[ Back ]


function IupToggleItem ( title$, state )

Create a toggle item for menu.

Parameter
Mode
Description
title
In
Label.
state
In
Default state (true/false or on/off)

Return value
Handle to control.

[ Back ]


function IupCloseItem ( title$ )

Create a close item for menu. This is NaaLaa specific for a menu item that closes the window.

Parameter
Mode
Description
title
In
Label.

Return value
Handle to control.

[ Back ]


function IupMenu ( handles[] )

Create a menu from handles.

Parameter
Mode
Description
handles
In
Handles to controls.

Return value
Handle to control.

[ Back ]


function IupSubmenu ( title$, menu )

Create a submenu from control.

Parameter
Mode
Description
title
In
Label.
menu
In
Handle to control.

Return value
Handle to control.

[ Back ]


function IupSeparator ( )

Create a separator menu item.

Return value
Handle to control.

[ Back ]


function IupUser ( )

Create a user element.

Return value
Handle to control.

[ Back ]


function IupCtrlPlus ( key )

Return keycode for IUP_KEY_EVENT with Ctrl+.

Parameter
Mode
Description
key
In
Keycode.

Return value
Keycode.

[ Back ]


Generated with NLDoc 20140630.