newLISP and IUP UI library oddness
Posted: Sat Nov 12, 2011 11:49 am
Hi there,
I just played around with newLisp and its import capabilites.
My poi there was the famous IUP library, an UI lib, which is C-only.
So here is the code:
What is driving me nuts is this: if I call
(IupSetAttribute dialog "TITLE" "YES")
after (IupShow dialog), the title is displayed.
If I do it the other way around, it does not. Sometimes a single char is displayed like F or so.
I just coded this in Python using ctypes, and there the order of the operations does not matter.
The title is always displayed.
Even in an hand-coded C equivalent the order does not matter.
OS is Windows 7 Ultimate, 32 Bit, newLisp is newLISP v.10.3.5 on Win32 IPv4/6 UTF-8 and
the IUP dll offers this version:
Any hints ?
I just played around with newLisp and its import capabilites.
My poi there was the famous IUP library, an UI lib, which is C-only.
So here is the code:
Code: Select all
(import "iup.dll" "IupOpen")
(import "iup.dll" "IupClose")
(import "iup.dll" "IupText")
(import "iup.dll" "IupButton")
(import "iup.dll" "IupSetAttribute")
(import "iup.dll" "IupGetAttribute")
(import "iup.dll" "IupSetAttributeHandle")
(import "iup.dll" "IupSetAttributes")
(import "iup.dll" "IupSetCallback")
(import "iup.dll" "IupShowXY")
(import "iup.dll" "IupShow")
(import "iup.dll" "IupDialog")
(import "iup.dll" "IupMainLoop")
(import "iup.dll" "IupLabel")
(import "iup.dll" "IupVbox")
(define (quit_cb) (- 0 3)) ; IUP_DEFAULT=-3
(IupOpen)
(set 'quit_bt (IupButton "Quit" 0))
(IupSetCallback quit_bt "ACTION" (callback 0 'quit_cb))
(set 'label (IupLabel "Very long label"))
(IupSetAttribute label "EXPAND=YES")
(IupSetAttribute label "ALIGNMENT=ACENTER")
(set 'vbox (IupVbox label quit_bt 0))
(IupSetAttribute vbox "MARGIN" "10x10")
(IupSetAttribute vbox "GAP" "5")
(IupSetAttribute vbox "ALIGNMENT=ACENTER")
(set 'dialog (IupDialog vbox) )
(IupSetAttribute dialog "EXPAND" "YES")
(IupSetAttribute dialog "SIZE" "QUARTER")
(IupSetAttributeHandle dialog "DEFAULTESC" quit_bt)
(IupShow dialog)
(IupSetAttribute dialog "TITLE" "YES")
(IupMainLoop)
(IupClose)
(exit)
(IupSetAttribute dialog "TITLE" "YES")
after (IupShow dialog), the title is displayed.
If I do it the other way around, it does not. Sometimes a single char is displayed like F or so.
I just coded this in Python using ctypes, and there the order of the operations does not matter.
The title is always displayed.
Even in an hand-coded C equivalent the order does not matter.
OS is Windows 7 Ultimate, 32 Bit, newLisp is newLISP v.10.3.5 on Win32 IPv4/6 UTF-8 and
the IUP dll offers this version:
Code: Select all
(import "iup.dll" "IupVersion")
(get-string (IupVersion))
"3.5"