Extension Modules > IUP
IUP Linux and Windows
Support:
BUILD 6
As promised, here are the list functions returned in a ScriptBasic array. (see previous post)
Iup::GetAllAttributes
Iup::GetAllClasses
Iup::GetClassAttributes
Iup::GetClassCallbacks
Iup::GetAllNames
Iup::GetAllDialogs
Support:
Who will be the first one (other than me) to post an example of IUP working with ScriptBasic on either Windows or Linux?
Based on the number of downloads and views of this thread, I'm willing to bet someone gave it a try.
If you're not a member of the forum, (what are you waiting for?) send me your code to post. (support@scriptbasic.org)
Support:
One of my goals with the ScriptBasic IUP binding was to be able to use to output of the IUP dialog layout tool (see attached) to generate screen code I could use. Currently the dialog layout tool only generates C, Lua and LED source code. The C output was close enough that with a few tweaks, I could get it to run in SB.
Original C output
--- Code: ---/* Generated by IupLayoutDialog export to C. */
#include <stdlib.h>
#include <iup.h>
Ihandle* create_dialog_iupdict2(void)
{
Ihandle* containers[10];
containers[4] = IupSetAtt(NULL, IupCreatep("hbox",
IupSetAtt(NULL, IupCreate("list"),
"EXPAND", "HORIZONTAL",
"SIZE", "120x",
"VALUE", "1",
"DROPDOWN", "YES",
NULL),
IupSetAtt(NULL, IupCreate("button"),
"SIZE", "50x",
"TITLE", "Fetch",
NULL),
NULL),
"GAP", "5",
NULL);
containers[3] = IupSetAtt(NULL, IupCreatep("frame",
containers[4],
NULL),
"TITLE", "Servers",
NULL);
containers[6] = IupSetAtt(NULL, IupCreatep("hbox",
IupSetAtt(NULL, IupCreate("button"),
"SIZE", "50x",
"TITLE", "About",
NULL),
IupSetAtt(NULL, IupCreate("button"),
"SIZE", "50x",
"TITLE", "Clear",
NULL),
IupSetAtt(NULL, IupCreate("button"),
"SIZE", "50x",
"TITLE", "Exit",
NULL),
NULL),
"GAP", "5",
NULL);
containers[5] = IupSetAtt(NULL, IupCreatep("frame",
containers[6],
NULL),
"TITLE", "Controls",
NULL);
containers[2] = IupSetAtt(NULL, IupCreatep("hbox",
containers[3],
containers[5],
NULL),
"GAP", "10",
NULL);
containers[7] = IupSetAtt(NULL, IupCreatep("frame",
IupSetAtt(NULL, IupCreate("list"),
"EXPAND", "YES",
"VISIBLELINES", "1",
NULL),
NULL),
"TITLE", "Dictionaries",
NULL);
containers[8] = IupSetAtt(NULL, IupCreatep("frame",
IupSetAtt(NULL, IupCreate("text"),
"EXPAND", "YES",
"MULTILINE", "YES",
NULL),
NULL),
"TITLE", "Translation",
NULL);
containers[9] = IupSetAtt(NULL, IupCreatep("hbox",
IupSetAtt(NULL, IupCreate("label"),
"SIZE", "x12",
"TITLE", "Enter Word to Search For:",
NULL),
IupSetAtt(NULL, IupCreate("text"),
"EXPAND", "HORIZONTAL",
NULL),
IupSetAtt(NULL, IupCreate("button"),
"SIZE", "50x",
"TITLE", "Search",
NULL),
IupSetAtt(NULL, IupCreate("toggle"),
"SIZE", "x12",
"TITLE", "ALL",
NULL),
IupSetAtt(NULL, IupCreate("toggle"),
"SIZE", "x12",
"TITLE", "UTF-8",
NULL),
NULL),
"GAP", "10",
NULL);
containers[1] = IupSetAtt(NULL, IupCreatep("vbox",
containers[2],
containers[7],
containers[8],
containers[9],
NULL),
"MARGIN", "10x10",
NULL);
containers[0] = IupSetAtt(NULL, IupCreatep("dialog",
containers[1],
NULL),
"TITLE", "Thesaurus",
"RASTERSIZE", "875x638",
NULL);
return containers[0];
}
--- End code ---
Converted to ScriptBasic
--- Code: ---IMPORT iup.bas
Iup::Open()
containers[4] = Iup::SetAtt("", Iup::Createp("hbox", _
Iup::SetAtt("", Iup::Create("list"), _
"EXPAND", "HORIZONTAL", _
"SIZE", "120x", _
"VALUE", "1", _
"DROPDOWN", "YES"), _
Iup::SetAtt("", Iup::Create("button"), _
"SIZE", "50x", _
"TITLE", "Fetch")), _
"GAP", "5")
containers[3] = Iup::SetAtt("", Iup::Createp("frame", _
containers[4]), _
"TITLE", "Servers")
containers[6] = Iup::SetAtt("", Iup::Createp("hbox", _
Iup::SetAtt("", Iup::Create("button"), _
"SIZE", "50x", _
"TITLE", "About"), _
Iup::SetAtt("", Iup::Create("button"), _
"SIZE", "50x", _
"TITLE", "Clear"), _
Iup::SetAtt("", Iup::Create("button"), _
"SIZE", "50x", _
"TITLE", "Exit")), _
"GAP", "5")
containers[5] = Iup::SetAtt("", Iup::Createp("frame", _
containers[6]), _
"TITLE", "Controls")
containers[2] = Iup::SetAtt("", Iup::Createp("hbox", _
containers[3], _
containers[5]), _
"GAP", "10")
containers[7] = Iup::SetAtt("", Iup::Createp("frame", _
Iup::SetAtt("", Iup::Create("list"), _
"EXPAND", "YES", _
"VISIBLELINES", "1")), _
"TITLE", "Dictionaries")
containers[8] = Iup::SetAtt("", Iup::Createp("frame", _
Iup::SetAtt("", Iup::Create("text"), _
"EXPAND", "YES", _
"MULTILINE", "YES")), _
"TITLE", "Translation")
containers[9] = Iup::SetAtt("", Iup::Createp("hbox", _
Iup::SetAtt("", Iup::Create("label"), _
"SIZE", "x12", _
"TITLE", "Enter Word to Search For:"), _
Iup::SetAtt("", Iup::Create("text"), _
"EXPAND", "HORIZONTAL"), _
Iup::SetAtt("", Iup::Create("button"), _
"SIZE", "50x", _
"TITLE", "Search"), _
Iup::SetAtt("", Iup::Create("toggle"), _
"SIZE", "x12", _
"TITLE", "ALL"), _
Iup::SetAtt("", Iup::Create("toggle"), _
"SIZE", "x12", _
"TITLE", "UTF-8")), _
"GAP", "10")
containers[1] = Iup::SetAtt("", Iup::Createp("vbox", _
containers[2], _
containers[7], _
containers[8], _
containers[9]), _
"MARGIN", "10x10")
containers[0] = Iup::SetAtt("", Iup::Createp("dialog", _
containers[1]), _
"TITLE", "Thesaurus", _
"RASTERSIZE", "875x638")
Iup::SetCallback(containers[0],"CLOSE_CB",ADDRESS(Win_exit()))
Iup::Show(containers[0])
Iup::MainLoop()
Iup::Close()
END
SUB Win_exit
Iup::ExitLoop = TRUE
END SUB
--- End code ---
Support:
I'm in the process of converting the C examples on the IUP project site.
C Version
ScriptBasic Version
--- Code: ---' Iup Alarm: Example in SB
' Shows a dialog similar to the one shown when you exit a program without saving.
IMPORT iup.bas
' Initializes IUP
Iup::Open()
' Executes IupAlarm
response = Iup::Alarm ("IupAlarm Example", "File not saved! Save it now?", "Yes", "No", "Cancel")
' Shows a message for each selected button
IF response = 1 THEN Iup::Message ("Save file", "File saved successfully - leaving program")
IF response = 2 THEN Iup::Message ("Save file", "File not saved - leaving program anyway")
IF response = 3 THEN Iup::Message ("Save file", "Operation canceled")
' Finishes IUP
Iup::Close()
' Program finished successfully
END
--- End code ---
Support:
BUILD 7
[*]Iup::SetAtt - now supports multiple attribute pairs and setting the handle name if provided.
[*]Iup::Createp - now supports appending children to containers.
[/list]
So far I have been able to eliminate NULL as a argument to terminate parameter lists. With optional parameter support and knowing how many arguments were passed to the interface module, (SB API) the need for a NULL argument as a list terminator dissipated.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version