Oxygen Basic

Programming => Example Code => User Interface => Topic started by: jcfuller on August 08, 2012, 04:27:34 AM

Title: need O2 IUP translation
Post by: jcfuller on August 08, 2012, 04:27:34 AM
Charles,
  I attempted to create an Oxygen IUP demo with no success so I present here the bc9 (ansi/iso "c" bcx) source and attach the c source and exe linked statically so you can run the demo without the library. exe was compressed with upx.

One of the things I like about IUP is the ease to anchor,expand, and contract controls on a form.

This is their main page:
http://www.tecgraf.puc-rio.br/iup/

From there you can go to sourceforge to select the library package you want to use with Oxygen.

James

Bc9 source:
Code: [Select]
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'itest.bas
'bc9c example using the IUP interface library
'translate with -xinc
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
$ONEXIT "cfix $FILE$.c"
'dll
'$ONEXIT "gcc -m32 $FILE$.c -o$FILE$.exe -s -I\iup\include -I\cd-55\include -L\iup -L\cd-55 -liup -liupcontrols -liupcd -lcomctl32 -lole32 -lgdi32 -lcomdlg32 -lcd"
'static
$ONEXIT "gcc -m32 $FILE$.c -o$FILE$.exe -s -static-libgcc -mwindows -I\iup_gw4\include  -L\iup_gw4 -liup -liupcontrols -liupcd -lcomctl32 -lole32 -lgdi32 -lcomdlg32"

$ONEXIT "GORC /r $FILE$.rc"
$ONEXIT "LinkRes2Exe $FILE$.res $FILE$.exe"

#include <windows.h>
#include "iup.h"

'CONTROLS, SO MANY DAMN CONTROLS....
Dim As Ihandle Ptr win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame, _
                   controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame, _
                   text,bottomBox,label,entry,btnSearch,chkAll,chkUTF
'Initialize IUP
IupOpen(0,0)
'Create Main Window
win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",NULL)

'create container to house ALL GUI objects
vbox = Create("vbox","MARGIN=10x10",NULL)

'Create Server panel
 topBox = Create("hbox", " GAP=10", vbox)
  serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
   serverBox= Create("hbox", "GAP=5", serverFrame)
    serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
    btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)
    
'Create control panel
  controlFrame = Create("frame", "TITLE=Controls", topBox)
   controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame)
    btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox)
    btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
    btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox)
    'SETUP CALLBACK FOR EXIT BUTTON
    IupSetCallback(btnExit, "ACTION", (Icallback)quit_cb)
    
'Create dictionary panel
 dictFrame = Create("frame", "TITLE=Dictionaries", vbox)
  serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)

'Create text part
 transFrame = Create("frame", "TITLE=Translation", vbox)
  text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)

'Create entry and search button
 bottomBox = Create("hbox", "GAP=10", vbox)
  label = Create("label", "TITLE="+ enc$("Enter Word to Search For:",0,0)+", SIZE=x12", bottomBox)
  entry = Create("text", " EXPAND=HORIZONTAL",bottomBox)
  btnSearch = Create("button","TITLE=Search, SIZE=50x", bottomBox)
  chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
  chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)
        
'Add the main GUI container to the Window
AddChild(win, vbox)
'Show the Window
IupShow(win)
IupSetFocus(btnFetch)
IupMainLoop()
IupClose()
'==============================================================================
function quit_cb() as long
  function = IUP_CLOSE
end function
'==============================================================================
sub AddChild(parent as Ihandle ptr, child as Ihandle ptr)
 IupAppend(parent, child)
 IupRefresh(parent)
end sub
'==============================================================================
'FUNCTION CREATE
'    CREATES GUI OBJECT
'
'    VALUE = OBJECT CLASS (string)
'    ATTR = ATTRIBUTES TO PASS TO OBJECT (string)
'    PARENT  = PARENT TO PLACE OBJECT ON (Ihandle*)
'------------------------------------------------------------------------------
Function Create (Value as string, Attr as string, parent as Ihandle ptr) as Ihandle ptr
    local iHwnd as Ihandle ptr
    iHwnd = IupCreate(Value);
    If iHwnd Then
        If len(Attr) Then
             IupSetAttributes(iHwnd, Attr)    
        End If
        If parent Then
            AddChild(parent, iHwnd)
        End If
        Function = iHwnd
    End If
    Function = NULL
End Function




X
Title: Re: need O2 IUP translation
Post by: JRS on August 08, 2012, 09:16:53 AM
I'm with James on this one. IUP is a very cool API for native GUI on Windows and Linux.

Title: Re: need O2 IUP translation
Post by: Aurel on August 08, 2012, 11:02:10 AM
I have tried it once and is not so cool like you say.
It wrap only Dialog frame as modal.(not window)
Of course this wrapper require less coding.
By the way what exactly need this thing?
I have
iup.dll
complete include folder with iup.h
and iup.lib file

Is that enough to create GUI app ?
Ok i will try one more time  ::)
Title: Re: need O2 IUP translation
Post by: Aurel on August 08, 2012, 12:54:25 PM
Uff i try translate few exemples from FB but without succses ::)
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 08, 2012, 01:01:05 PM
Is there an official IUP.DLL?

Title: Re: need O2 IUP translation
Post by: jcfuller on August 08, 2012, 01:26:39 PM
Is there an official IUP.DLL?



Official? Sorry Charles I don't follow?

This is a link to the dynamic ones available
http://sourceforge.net/projects/iup/files/3.6/Windows%20Libraries/Dynamic/

At the bottom of the page it lists the different types which unfortunately does not match the actual libraries.

I used an older 3.5 version with a PowerBASIC demo.
http://sourceforge.net/projects/iup/files/3.5/Windows%20Libraries/iup-3.5_Win32_dll6_lib.zip/download

James

Title: Re: need O2 IUP translation
Post by: jcfuller on August 08, 2012, 03:02:06 PM
Charles,
  This is the PowerBASIC demo.
James


Code: [Select]
'=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
'I used IUP build 3.5
'http://sourceforge.net/projects/iup/files/3.5/Windows%20Libraries/iup-3.5_Win32_dll6_lib.zip/download
'SED_PBWIN
#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "windows.inc"
#RESOURCE MANIFEST,1, "xpmanifest.xml"
'Change path to iup.dll if need be.
$DLLNAME = "\iup_dll6\iup.dll"
%IUP_CLOSE = -3
%IUP_ERROR = 1
DECLARE FUNCTION IupOpen CDECL IMPORT  $DLLNAME ALIAS  "IupOpen" (BYVAL argc AS DWORD,BYVAL argv AS DWORD)AS LONG
DECLARE FUNCTION IupCreate CDECL IMPORT  $DLLNAME ALIAS  "IupCreate"(cname As stringz) AS DWORD
DECLARE SUB IupClose CDECL IMPORT  $DLLNAME ALIAS "IupClose"()
DECLARE FUNCTION IupSetAttributes CDECL IMPORT  $DLLNAME ALIAS "IupSetAttributes"(BYVAL ih AS DWORD,strz As stringz) AS DWORD
DECLARE FUNCTION IupAppend CDECL IMPORT  $DLLNAME ALIAS "IupAppend"(BYVAL ih AS DWORD,BYVAL child AS DWORD) AS DWORD
DECLARE SUB IupRefresh CDECL IMPORT  $DLLNAME ALIAS "IupRefresh"(BYVAL ih AS DWORD)
DECLARE FUNCTION IupSetCallback CDECL IMPORT  $DLLNAME ALIAS "IupSetCallback"(BYVAL ih As DWORD,sname As stringz,BYVAL func AS DWORD) AS DWORD
DECLARE FUNCTION IupShow CDECL IMPORT  $DLLNAME ALIAS "IupShow"(BYVAL ih AS DWORD) As Long
DECLARE FUNCTION IupSetFocus CDECL IMPORT  $DLLNAME ALIAS "IupSetFocus"(BYVAL ih As DWORD) AS DWORD
DECLARE SUB IupMainLoop CDECL IMPORT  $DLLNAME ALIAS "IupMainLoop"()

FUNCTION PBMAIN () AS LONG
    LOCAL rv As LONG
    LOCAL win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame, _
                   controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame, _
                   text,bottomBox,label,entry,btnSearch,chkAll,chkUTF AS DWORD
 
    'Initialize IUP     
    rv = IupOpen(0,0)
    IF rv = %IUP_ERROR THEN
        MsgBox "Initialize Failed"
        EXIT FUNCTION
    END IF   
   
    'Create Main Window
    win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",0)
    'create container to house ALL GUI objects
    vbox = Create("vbox","MARGIN=10x10",0)
    'Create Server panel
     topBox = Create("hbox", " GAP=10", vbox)
      serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
       serverBox= Create("hbox", "GAP=5", serverFrame)
        serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
        btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)
    'Create control panel
      controlFrame = Create("frame", "TITLE=Controls", topBox)
       controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame)
        btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox)
        btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
        btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox)
        'SETUP CALLBACK FOR EXIT BUTTON
        IupSetCallback(btnExit, "ACTION", CODEPTR(quit_cb))
    'Create dictionary panel
     dictFrame = Create("frame", "TITLE=Dictionaries", vbox)
      serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)
    'Create text part
     transFrame = Create("frame", "TITLE=Translation", vbox)
      text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)
    'Create entry and search button
     bottomBox = Create("hbox", "GAP=10", vbox)
      label = Create("label", "TITLE=Enter Word to Search For: , SIZE=x12", bottomBox)
      entry = Create("text", " EXPAND=HORIZONTAL",bottomBox)
      btnSearch = Create("button","TITLE=Search, SIZE=50x", bottomBox)
      chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
      chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)
    '       
    'Add the main GUI container to the Window
    AddChild(win, vbox)
    'Show the Window
    IupShow(win)
    IupSetFocus(btnFetch)
    IupMainLoop()
    IupClose()

END FUNCTION
'==============================================================================
'Exit Button Callback
FUNCTION quit_cb()cdecl AS LONG
  FUNCTION = %IUP_CLOSE
END FUNCTION
'***********************************************************************
'Helper functions
'***********************************************************************
'==============================================================================
SUB AddChild(parent As DWORD,child As DWORD)
    IupAppend parent,child
    IupRefresh parent
END SUB
'==============================================================================
FUNCTION Create ( Value As Stringz,Attr As Stringz,parent As DWORD)AS DWORD
    LOCAL hWnd AS DWORD
    hWnd = IupCreate(Value)
    If hWnd Then
        If Len(Attr) Then
            IupSetAttributes(hWnd,Attr)
        End If
        If parent Then
            AddChild parent,hWnd
        End If   
        Function = hWnd
    End If   
END FUNCTION


Title: Re: need O2 IUP translation
Post by: JRS on August 08, 2012, 05:22:24 PM
Here (http://www.scriptbasic.org/forum/index.php/topic,237.0.html) is the ScriptBasic extension module version of IUP.

It seems Peter's Thesaurus program has become the Hello World for Basic GUI toolkit integrators.  :D

@Charles - I believe I sent you the IUP extension module source a while back.

Code: [Select]
IMPORT iup.bas

servers[0]="dict.org"
servers[1]="dict1.us.dict.org"
servers[2]="all.dict.org"

about="""This is a Demo
of the IUP GUI Binding
for Scriptbasic"""

' Initialize IUP
Iup::Open()

' Create main window

win = Iup::Create("dialog")
  Iup::SetAttributes(win, "TITLE=Thesaurus, SIZE=500x300")
  Iup::SetCallback(win,"CLOSE_CB",ADDRESS(Win_exit()))

' Create container to house ALL GUI objects

vbox = Iup::Create("vbox")
  Iup::SetAttributes(vbox, "MARGIN=10x10")

' Create server panel

topBox = Iup::Create("hbox")
  Iup::SetAttributes(topBox, "GAP=10")
  Iup::Append(vbox, topBox)
serverFrame = Iup::Create("frame")
  Iup::SetAttributes(serverFrame, "TITLE=Servers, EXPAND=YES")
  Iup::Append(topBox, serverFrame)
serverBox = Iup::Create("hbox")
  Iup::SetAttributes(serverBox, "GAP=5")
  Iup::Append(serverFrame, serverBox)
serverCombo = Iup::Create("list")
  Iup::SetAttributes(serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1")
  Iup::Append(serverBox, serverCombo)
  Iup::SetCallback(serverCombo, "ACTION", ADDRESS(serverCombo_selected()))
btnFetch = Iup::Create("button")
  Iup::SetAttributes(btnFetch, "TITLE=Fetch, SIZE = 50x")
  Iup::Append(serverBox, btnFetch)
  Iup::SetCallback(btnFetch, "ACTION", ADDRESS(btnFetch_clicked()))

' Create control panel

controlFrame = Iup::Create("frame")
  Iup::SetAttributes(controlFrame, "TITLE=Controls")
  Iup::Append(topBox, controlFrame)
controlBox = Iup::Create("hbox")
  Iup::SetAttributes(controlBox, "GAP=5")
  Iup::Append(controlFrame, controlBox)
btnAbout = Iup::Create("button")
  Iup::SetAttributes(btnAbout, "TITLE=About, SIZE = 50x")
  Iup::Append(controlBox, btnAbout)
  Iup::SetCallback(btnAbout, "ACTION", ADDRESS(btnAbout_clicked()))
btnClear = Iup::Create("button")
  Iup::SetAttributes(btnClear, "TITLE=Clear, SIZE = 50x")
  Iup::Append(controlBox, btnClear)
  Iup::SetCallback(btnClear, "ACTION", ADDRESS(btnClear_clicked()))
btnExit = Iup::Create("button")
  Iup::SetAttributes(btnExit, "TITLE=Exit, SIZE = 50x")
  Iup::Append(controlBox, btnExit)
  Iup::SetCallback(btnExit,"ACTION",ADDRESS(Win_exit()))

' Create dictionary panel

dictFrame = Iup::Create("frame")
  Iup::SetAttributes(dictFrame, "TITLE=Dictionaries")
  Iup::Append(vbox, dictFrame)
serverList = Iup::Create("list")
  Iup::SetAttributes(serverList, "EXPAND=YES, VISIBLELINES=1")
  Iup::Append(dictFrame, serverList)
  Iup::SetCallback(serverList, "ACTION", ADDRESS(serverList_selected()))

' Create text part

transFrame = IUP::Create("frame")
  Iup::SetAttributes(transFrame, "TITLE=Translation")
  Iup::Append(vbox, transFrame)
text = Iup::Create("text")
  Iup::SetAttributes(text, "MULTILINE=YES, EXPAND=YES")
  Iup::Append(transFrame, text)

' Create entry and search button

bottomBox = Iup::Create("hbox")
  Iup::SetAttributes(bottomBox, "GAP=10")
  Iup::Append(vbox, bottomBox)
label = Iup::Create("label")
  Iup::SetAttributes(label, "TITLE=\"Enter Word to Search For:\", SIZE=x12")
  Iup::Append(bottomBox, label)
entry = Iup::Create("text")
  Iup::SetAttributes(entry, "EXPAND=HORIZONTAL")
  Iup::Append(bottomBox, entry)
btnSearch = Iup::Create("button")
  Iup::SetAttributes(btnSearch,"TITLE=Search, SIZE=50x")
  Iup::Append(bottomBox, btnSearch)
  Iup::SetCallback(btnSearch, "ACTION", ADDRESS(btnSearch_clicked()))
chkAll = Iup::Create("toggle")
  Iup::SetAttributes(chkAll, "TITLE=ALL, SIZE=x12")
  Iup::Append(bottomBox, chkAll)
chkUTF = Iup::Create("toggle")
  Iup::SetAttributes(chkUTF, "TITLE=UTF-8, SIZE=x12")
  Iup::Append(bottomBox, chkUTF)

' Add the main GUI container to the Window

Iup::Append(win, vbox)

' Setup dialog defaults

Iup::Show(win)
Iup::SetFocus(btnFetch)
FOR i = 0 TO UBOUND(servers)
  Iup::SetAttribute(serverCombo, "APPENDITEM", servers[i])
NEXT
Iup::SetAttribute(serverCombo, "VALUE", "1")
Iup::Update(serverCombo)
server_selection = servers[0]

' Main processing loop

Iup::MainLoop()
Iup::Close()
END

' Callback routines

SUB Win_exit
  Iup::ExitLoop = TRUE
END SUB

SUB btnAbout_clicked
  Iup::Message("ABOUT", about)
END SUB

SUB serverCombo_selected
  server_selection = Iup::GetListText()
END SUB

SUB serverList_selected
  whichDictionary = Iup::GetListText()
END SUB

SUB btnFetch_clicked
  LOCAL dat, total, count
  ON ERROR GOTO G_NetError
  OPEN server_selection & ":2628" FOR SOCKET AS #1
  PRINT#1,"SHOW DB\n"
  LINE INPUT#1, dat
  LINE INPUT#1, dat
  count = 0
  WHILE LEFT(dat, 1) <> "."
    LINE INPUT#1, dat
    IF LEFT(dat, 1) <> "." THEN total[count] = TRIM(dat)
    count+=1
  WEND
  PRINT#1,"QUIT\n"
  CLOSE(#1)
  FOR cnt = 0 TO count - 2
    Iup::SetAttribute(serverList, "APPENDITEM", total[cnt])
  NEXT
  Iup::SetAttribute(serverList, "VALUE", "1")
  Iup::Update(serverCombo)
  whichDictionary = total[0]
  EXIT SUB

  G_NetError:
  PRINT "Server ",server_selection," not available. (",ERROR,")\n"
END SUB

SUB btnClear_clicked
  Iup::ClearList(serverList)
  Iup::SetAttribute(text, "VALUE", "")
  Iup::SetAttribute(entry, "VALUE", "")
END SUB

SUB btnSearch_clicked
  LOCAL dict, dat, total, info
  IUP::SetAttribute(text, "VALUE","Fetching....")
  ON ERROR GOTO L_NetError
  dict = LEFT(whichDictionary, INSTR(whichDictionary, " "))
  OPEN server_selection & ":2628" FOR SOCKET AS 1
  IF Iup::GetAttribute(chkAll, "VALUE") THEN
    PRINT#1,"DEFINE * " & Iup::GetAttribute(entry,"VALUE") & "\n"
  ELSE
    PRINT#1,"DEFINE " & dict & " " & Iup::GetAttribute(entry,"VALUE") & "\n"
  END IF
  REPEAT
    LINE INPUT#1, dat
    IF LEFT(dat, 3) = "151" THEN
      total$ &= "------------------------------\r\n"
      total$ &= RIGHT(dat, LEN(dat) - LEN(Iup::GetAttribute(entry, "VALUE")) - LEN(dict))
      total$ &= "------------------------------\r\n"
      REPEAT
        LINE INPUT#1, info
        info = REPLACE(info, CHR(34), CHR(92) & CHR(34))
        IF LEFT(info, 1) <> "." THEN total &= TRIM(info) & "\n"
      UNTIL LEFT(info, 1) = "."
      total &= "\n"
    END IF
  UNTIL LEFT(dat, 3) = "250" OR VAL(LEFT(dat, 3)) > 499
  PRINT#1,"QUIT\n"
  CLOSE(#1)
  IF LEFT(dat, 3) = "552" THEN
    total = "No match found."
  ELSE IF LEFT(dat, 3) = "501" THEN
    total = "Select a dictionary first!"
  ELSE IF LEFT(dat, 3) = "550" THEN
    total = "Invalid database!"
  END IF
  Iup::SetAttribute(text, "VALUE", total)
EXIT SUB

L_NetError:
  dat[0] = "Could not lookup word! (" & ERROR & ")"
  Iup::SetAttribute(text, "VALUE", dat)
END SUB



X
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 09, 2012, 02:24:04 AM
cygwin1.dll dependency, but I still can't get iup to open.

Code: OxygenBasic
  1.  
  2. 'IUP build 3.6 / Win32
  3.  
  4. %IUP_CLOSE = -3
  5. %IUP_ERROR = 1
  6.  
  7. extern lib "iup.dll" cdecl
  8.  
  9. ! IupOpen          (sys argc,argv) as sys
  10. ! IupCreate        (string cname) as sys
  11. ! IupClose         ()
  12. ! IupSetAttributes (sys ih,string strz) as sys
  13. ! IupAppend        (sys ih, child) as sys
  14. ! IupRefresh       (sys ih)
  15. ! IupSetCallback   (sys ih,string sname, sys func) as sys
  16. ! IupShow          (sys ih) as sys
  17. ! IupSetFocus      (sys ih) as sys
  18. ! IupMainLoop      ()
  19.  
  20. end extern
  21.  
  22. extern cdecl
  23.  
  24. 'Exit Button Callback
  25. function quit_cb() as sys
  26.   function = %IUP_CLOSE
  27. end function
  28.  
  29.  
  30. 'Helper functions
  31. '================
  32.  
  33.  
  34.  
  35. sub AddChild(sys *parent, *child)
  36.   IupAppend parent,child
  37.   IupRefresh parent
  38. end sub
  39.  
  40.  
  41. function Create ( string Value ,Attr ,sys parent) as sys
  42.   sys hWnd
  43.   hWnd = IupCreate(Value)
  44.   If hWnd Then
  45.     If Len(Attr)
  46.       IupSetAttributes(hWnd,Attr)
  47.     End If
  48.     If parent
  49.       AddChild parent,hWnd
  50.     End If    
  51.     Function = hWnd
  52.   End If    
  53. end function
  54.  
  55. function main () as sys
  56.   long rv As long
  57.   sys  win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame,
  58.        controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame,
  59.        text,bottomBox,label,entry,btnSearch,chkAll,chkUTF
  60.   'Initialize IUP      
  61.  rv = IupOpen(0,0)
  62. print "ok" rv
  63.   if rv = %IUP_ERROR
  64.     print "Initialize Failed"
  65.     EXIT FUNCTION
  66.   end if
  67.  
  68.    
  69.   'Create Main Window
  70.  win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",0)
  71.   'create container to house ALL GUI objects
  72.  vbox = Create("vbox","MARGIN=10x10",0)
  73.   'Create Server panel
  74.  topBox = Create("hbox", " GAP=10", vbox)
  75.   serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
  76.   serverBox= Create("hbox", "GAP=5", serverFrame)
  77.   serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
  78.   btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)
  79.   'Create control panel
  80.  controlFrame = Create("frame", "TITLE=Controls", topBox)
  81.   controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame)
  82.   btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox)
  83.   btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
  84.   btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox)
  85.   'SETUP CALLBACK FOR EXIT BUTTON
  86.  IupSetCallback(btnExit, "ACTION", @quit_cb)
  87.   'Create dictionary panel
  88.  dictFrame = Create("frame", "TITLE=Dictionaries", vbox)
  89.   serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)
  90.   'Create text part
  91.  transFrame = Create("frame", "TITLE=Translation", vbox)
  92.   text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)
  93.   'Create entry and search button
  94.  bottomBox = Create("hbox", "GAP=10", vbox)
  95.   label = Create("label", "TITLE=Enter Word to Search For: , SIZE=x12", bottomBox)
  96.   entry = Create("text", " EXPAND=HORIZONTAL",bottomBox)
  97.   btnSearch = Create("button","TITLE=Search, SIZE=50x", bottomBox)
  98.   chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
  99.   chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)
  100.   '        
  101.  'Add the main GUI container to the Window
  102.  AddChild(win, vbox)
  103.   'Show the Window
  104.  IupShow(win)
  105.   IupSetFocus(btnFetch)
  106.   IupMainLoop()
  107.   IupClose()
  108. end function
  109.  
  110. main
  111.  

Charles
Title: Re: need O2 IUP translation
Post by: jcfuller on August 09, 2012, 03:22:51 AM
I can't even get it to compile:
Code: [Select]
>"C:\OxygenBasic\gxo2" " -c iup01.o2bas"

ERROR:
parameters mismatch for procedure string:
params given : #long@0

OPTIONS:
string(sys,sys) returns string
string(sys,zstring) returns string
string(sys,string) returns string


WORD: cname
LINE: 9


>Exit code: 0


James
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 09, 2012, 03:47:09 AM
Could you show the source please James.
Title: Re: need O2 IUP translation
Post by: Peter on August 09, 2012, 04:07:26 AM
Hi Charles,

Do you mean this ?


X
Title: Re: need O2 IUP translation
Post by: jcfuller on August 09, 2012, 04:19:37 AM
Could you show the source please James.

It's your source from above, using SciTE to compile.
I am not using cygwin1.dll . I just wanted to see if it would compile.
Is it required to compile?

James

Code: [Select]
'IUP build 3.6 / Win32

%IUP_CLOSE = -3
%IUP_ERROR = 1

extern lib "iup.dll" cdecl

! IupOpen          (sys argc,argv) as sys
! IupCreate        (string cname) as sys
! IupClose         ()
! IupSetAttributes (sys ih,string strz) as sys
! IupAppend        (sys ih, child) as sys
! IupRefresh       (sys ih)
! IupSetCallback   (sys ih,string sname, sys func) as sys
! IupShow          (sys ih) as sys
! IupSetFocus      (sys ih) as sys
! IupMainLoop      ()

end extern

extern cdecl

'Exit Button Callback
function quit_cb() as sys
  function = %IUP_CLOSE
end function


'Helper functions
'================



sub AddChild(sys *parent, *child)
  IupAppend parent,child
  IupRefresh parent
end sub


function Create ( string Value ,Attr ,sys parent) as sys
  sys hWnd
  hWnd = IupCreate(Value)
  If hWnd Then
    If Len(Attr)
      IupSetAttributes(hWnd,Attr)
    End If
    If parent
      AddChild parent,hWnd
    End If    
    Function = hWnd
  End If    
end function

function main () as sys
  long rv As long
  sys  win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame,
       controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame,
       text,bottomBox,label,entry,btnSearch,chkAll,chkUTF
  'Initialize IUP      
  rv = IupOpen(0,0)
print "ok" rv
  if rv = %IUP_ERROR
    print "Initialize Failed"
    EXIT FUNCTION
  end if

    
  'Create Main Window
  win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",0)
  'create container to house ALL GUI objects
  vbox = Create("vbox","MARGIN=10x10",0)
  'Create Server panel
  topBox = Create("hbox", " GAP=10", vbox)
  serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
  serverBox= Create("hbox", "GAP=5", serverFrame)
  serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
  btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)
  'Create control panel
  controlFrame = Create("frame", "TITLE=Controls", topBox)
  controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame)
  btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox)
  btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
  btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox)
  'SETUP CALLBACK FOR EXIT BUTTON
  IupSetCallback(btnExit, "ACTION", @quit_cb)
  'Create dictionary panel
  dictFrame = Create("frame", "TITLE=Dictionaries", vbox)
  serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)
  'Create text part
  transFrame = Create("frame", "TITLE=Translation", vbox)
  text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)
  'Create entry and search button
  bottomBox = Create("hbox", "GAP=10", vbox)
  label = Create("label", "TITLE=Enter Word to Search For: , SIZE=x12", bottomBox)
  entry = Create("text", " EXPAND=HORIZONTAL",bottomBox)
  btnSearch = Create("button","TITLE=Search, SIZE=50x", bottomBox)
  chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
  chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)
  '        
  'Add the main GUI container to the Window
  AddChild(win, vbox)
  'Show the Window
  IupShow(win)
  IupSetFocus(btnFetch)
  IupMainLoop()
  IupClose()
end function

main
James
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 09, 2012, 05:06:32 AM
Thanks. Are you using an old Oxygen James?

Anyway, the problem with IUP.dll is strange. Something of a brick wall.


X
Title: Re: need O2 IUP translation
Post by: jcfuller on August 09, 2012, 05:14:06 AM
Charles,
  Same results with your attached dll.

James
Title: Re: need O2 IUP translation
Post by: jcfuller on August 09, 2012, 06:35:06 AM
This is a FreeBASIC demo that works using
http://sourceforge.net/projects/iup/files/3.5/Windows%20Libraries/iup-3.5_Win32_dll6_lib.zip/download

James


Code: [Select]
extern lib "\iup_dll6\iup.dll"
    sys IupOpen (sys argc ,sys argv)
    sys IupCreate (char* cname)
    void IupClose()
    sys IupSetAttributes(sys ih ,char* strz)
    sys IupAppend (sys ih ,sys child)
    void IupRefresh(sys ih)
    sys IupSetCallback (sys ih ,char* sname ,sys func)
    sys IupShow (sys ih)
    sys IupSetFocus (sys ih)
    void IupMainLoop()
    void IupMessage(char* title, char *msg)
end extern

'' Initializes IUP
    IupOpen(0,0)

'' Executes IupMessage
  IupMessage("IupMessage Example", "Press the button")

  '' Initializes IUP main loop
  IupMainLoop ()

  '' Finishes IUP
  IupClose ()

Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 09, 2012, 07:20:33 AM
Is the  new Oxygen in the same directory as your compilers: gxo2 / exo2 ?
Title: Re: need O2 IUP translation
Post by: jcfuller on August 09, 2012, 08:23:49 AM

Yes

James
Title: Re: need O2 IUP translation
Post by: Peter on August 09, 2012, 08:29:07 AM
Hi,

try this.

X
Title: Re: need O2 IUP translation
Post by: Aurel on August 09, 2012, 08:35:51 AM
I am not sure what is wrong but looks to me that oxygen don't recognize
.lib file.
I made quick test
create dll in Ebasic
create import library .lib file
create .inc file who call .lib file
but how include .lib file - not in scope ???
Title: Re: need O2 IUP translation
Post by: Aurel on August 09, 2012, 08:40:38 AM
What a fu**   ;D
Eh - Peter you are really MEISTER... ;)
Thank you...
So there is a catch which i never will figured... ::)
Code: [Select]
extern lib "iup.dll" cdecl
sys iup
iup = LoadLibrary "iup.dll"
....
....
end extern
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 09, 2012, 09:04:33 AM
Thanks Peter

Your IUP dll works with my demo translation (above) too!

I see your version is 3.1.0.0, whereas the duff version I was struggling with is also labelled 3.1.0.0.

Where did you get it from?

James,

Your system is trying to use an old oxygen.dll, rather than the new one. I think it's the new '!' syntax for declarations causing the error.

Aurel,

Libs are not supported - I understand they are compiler-specific: FB uses the GNU linker.

Charles
Title: Re: need O2 IUP translation
Post by: efgee on August 09, 2012, 09:14:04 AM
IUP is a nice little GUI library.
Doesn't have as many controls as other GUI libraries like wxWidget or QT but is much easier to use  8)

The only downside (for me) is that there is no OSX version  :'(
Title: Re: need O2 IUP translation
Post by: Peter on August 09, 2012, 09:33:52 AM
Quote
Where did you get it from?

sorry Charles, I did forget the link.
But some interesting  DEFs for IUP can you find here.


X
Title: Re: need O2 IUP translation
Post by: Aurel on August 09, 2012, 09:40:51 AM
Quote
Aurel,
Libs are not supported - I understand they are compiler-specific: FB uses the GNU linker.
Aha ,i see and i think that would work without .lib file ,only dll.is important for LoadLibrary().
But i am not 100% sure ,ok i will try... ;)
Title: Re: need O2 IUP translation
Post by: JRS on August 09, 2012, 09:59:00 AM
Quote
The only downside (for me) is that there is no OSX version.

On a positive note, we have 4 or so Basic languages (interpreter, translator and compilers) all executing the same IUP GUI code. That in itself makes this worth doing.

Title: Re: need O2 IUP translation
Post by: Peter on August 09, 2012, 10:44:22 AM
Hi,

Here is my  iup teacher. Grandmother Wirbelauer, Physics/Mathematics Professor.

X
Title: Re: need O2 IUP translation
Post by: Aurel on August 09, 2012, 11:36:07 AM
Uff ..i always mean that your teacher is Opa  ;D
zwei + zwei ist drei.... 8)
Title: Re: need O2 IUP translation
Post by: jcfuller on August 09, 2012, 12:00:03 PM
Charles,
  There is no other oxygen.dll on my machine.
To be sure I did a complete search.
I then deleted my OxygenBasic directory and downloaded the in progress version

I copied your code from above.
I fired up SciTE.
I pasted and saved the code.

I then did a tools->compile and get this in the right pane:

Code: [Select]
>"C:\OxygenBasic\gxo2" " -c t01.o2bas"

ERROR:
parameters mismatch for procedure string:
params given : #long@0

OPTIONS:
string(sys,sys) returns string
string(sys,zstring) returns string
string(sys,string) returns string


WORD: cname
LINE: 10


>Exit code: 0


I then deleted the oxygen.dll and tried again.
I then got a can't find oxygen.dll popup.

I added the oxygen.dll from your link above and the results were the same as the first attempt.


James
Title: Re: need O2 IUP translation
Post by: Aurel on August 09, 2012, 12:14:26 PM
James
do you try
strptr cname
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 09, 2012, 01:04:09 PM
James,

I declare your machine haunted by the Ghost of Oxygen.dll past :). It's hiding in there somewhere.

All I can suggest is replacing '!' with 'declare function', and see if it accepts everything else. (This feature was introduced 3 June, 1 month prior to the A039 release)

If it is still using the old dll then a substantial number of the examples & projects will appear broken.

Charles
Title: Re: need O2 IUP translation
Post by: Peter on August 09, 2012, 03:29:12 PM
Hi,

Quote
I then deleted the oxygen.dll and tried again.
I then got a can't find oxygen.dll popup.

Lol

Try this dll.

X
Title: Re: need O2 IUP translation
Post by: jcfuller on August 10, 2012, 03:12:51 AM
Charles,
It is not a dll issue. I have the latest oxygen.dll. There are no ghosts
 I think some non printable characters are being copied and pasted.

Please attach a working example source.

James
 

Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 10, 2012, 04:30:54 AM
Hi James,

I checked the forum copy/paste and it was ok.

Attached here:

X
Title: Re: need O2 IUP translation
Post by: jcfuller on August 10, 2012, 04:48:25 AM
Ok, I figured a couple of things out.
As Peter did not know where he got his dll I tried one of  the "official" ones from the IUP sourceforge 3.6 downloads.

I tried:
http://sourceforge.net/projects/iup/files/3.6/Windows%20Libraries/Dynamic/iup-3.6_Win32_dllw4_lib.zip/download
and it worked fine.

This code compiles and runs fine.
The secret was the IupOpen declaration.
I checked The FreeBasic iup.bi and it had it with no parameters.

Code: [Select]
extern lib "\iup_dllw4\iup.dll" cdecl
! IupOpen()
! IupClose()
! IupMessage(string title, string msg)
end extern

IupOpen()
IupMessage("IupMessage Example", "Press the button")
IupClose()


I have not tried your upload yet.
I will try next

James


 
Title: Re: need O2 IUP translation
Post by: jcfuller on August 10, 2012, 05:00:17 AM
The problem was the IupOpen.
This compiles and runs fine.
I used
http://sourceforge.net/projects/iup/files/3.6/Windows%20Libraries/Dynamic/iup-3.6_Win32_dllw4_lib.zip/download

James


Code: [Select]

%IUP_CLOSE = -3
%IUP_ERROR = 1


extern lib "\iup_dllw4\iup.dll" cdecl
! IupOpen()
! IupCreate(string cname) as sys
! IupClose         ()
! IupSetAttributes (sys ih,string strz) as sys
! IupAppend        (sys ih, child) as sys
! IupRefresh       (sys ih)
! IupSetCallback   (sys ih,string sname, sys func) as sys
! IupShow          (sys ih) as sys
! IupSetFocus      (sys ih) as sys
! IupMainLoop      ()

end extern

extern cdecl

'Exit Button Callback
function quit_cb() as sys
  function = %IUP_CLOSE
end function


'Helper functions
'================



sub AddChild(sys *parent, *child)
  IupAppend parent,child
  IupRefresh parent
end sub


function Create ( string Value ,Attr ,sys parent) as sys
  sys hWnd
  hWnd = IupCreate(Value)
  If hWnd Then
    If Len(Attr)
      IupSetAttributes(hWnd,Attr)
    End If
    If parent
      AddChild parent,hWnd
    End If   
    Function = hWnd
  End If   
end function

function main () as sys
  long rv As long
  sys  win,vbox,topBox,serverFrame,serverBox,serverCombo,btnFetch,controlFrame,
       controlBox,btnAbout,btnClear,btnExit,dictFrame,serverList,transFrame,
       text,bottomBox,label,entry,btnSearch,chkAll,chkUTF
  'Initialize IUP     
  IupOpen()

   
  'Create Main Window
  win = Create("dialog","TITLE=Thesaurus, SIZE=500x300",0)
  'create container to house ALL GUI objects
  vbox = Create("vbox","MARGIN=10x10",0)
  'Create Server panel
  topBox = Create("hbox", " GAP=10", vbox)
  serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
  serverBox= Create("hbox", "GAP=5", serverFrame)
  serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
  btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)
  'Create control panel
  controlFrame = Create("frame", "TITLE=Controls", topBox)
  controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame)
  btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox)
  btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
  btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox)
  'SETUP CALLBACK FOR EXIT BUTTON
  IupSetCallback(btnExit, "ACTION", @quit_cb)
  'Create dictionary panel
  dictFrame = Create("frame", "TITLE=Dictionaries", vbox)
  serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)
  'Create text part
  transFrame = Create("frame", "TITLE=Translation", vbox)
  text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)
  'Create entry and search button
  bottomBox = Create("hbox", "GAP=10", vbox)
  label = Create("label", "TITLE=Enter Word to Search For: , SIZE=x12", bottomBox)
  entry = Create("text", " EXPAND=HORIZONTAL",bottomBox)
  btnSearch = Create("button","TITLE=Search, SIZE=50x", bottomBox)
  chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
  chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)
  '       
  'Add the main GUI container to the Window
  AddChild(win, vbox)
  'Show the Window
  IupShow(win)
  IupSetFocus(btnFetch)
  IupMainLoop()
  IupClose()
end function

main




 
Title: Re: need O2 IUP translation
Post by: Peter on August 10, 2012, 05:24:17 AM
Hi Charles,

Another iup demo.

Code: [Select]
#define IUP_TITLE  "TITLE"

%IUP_CLOSE = -3 
%IUP_ERROR = 1 

enum { IUP_DRAW_FILL, IUP_DRAW_STROKE, IUP_DRAW_STROKE_DASH }

typedef struct Ihandle_ {}
Ihandle_ Ihandle
typedef int (*Icallback)(Ihandle*)
typedef struct _IdrawCanvas {}
_IdrawCanvas IdrawCanvas

! IupOpen             Lib "iup.dll" (sys argc,argv) as sys 
! IupCreate           Lib "iup.dll" (string cname) as sys 
! IupSetAttributes    Lib "iup.dll" (sys ih,string strz) as sys 
! IupAppend           Lib "iup.dll" (sys ih, child) as sys 
! IupRefresh          Lib "iup.dll" (sys ih) 
! IupSetCallback      Lib "iup.dll" (sys ih,string sname, sys func) as sys 
! IupShow             Lib "iup.dll" (sys ih) as sys 
! IupShowXY           Lib "iup.dll" (Ihandle *ih, sys x, sys y) as sys
! IupSetFocus         Lib "iup.dll" (sys ih) as sys 
! IupRecordInput      Lib "iup.dll" (string *filename, sys mode) as sys
! IupPlayInput        Lib "iup.dll" (string *filename) as sys
! IupMainLoop         Lib "iup.dll" () as sys
! IupImageLibOpen     Lib "iup.dll" () as sys
! IupLoopStep         Lib "iup.dll" () as sys
! IupLoopStepWait     Lib "iup.dll" () as sys
! IupMainLoopLevel    Lib "iup.dll" () as sys
! IupClose            Lib "iup.dll" ()
! IupFlush            Lib "iup.dll" ()
! IupExitLoop         Lib "iup.dll" ()
! IupUpdate           Lib "iup.dll" (Ihandle *ih)
! IupUpdateChildren   Lib "iup.dll" (Ihandle *ih)
! IupRedraw           Lib "iup.dll" (Ihandle *ih, sys children)
! IupRefresh          Lib "iup.dll" (Ihandle *ih)
! IupRefreshChildren  Lib "iup.dll" (Ihandle *ih) 
! IupMapFont          Lib "iup.dll" (string *iupfont) as string
! IupUnMapFont        Lib "iup.dll" (string *driverfont) as string
! IupHelp             Lib "iup.dll" (string url) as sys
! IupLoad             Lib "iup.dll" (string *filename) as string
! IupLoadBuffer       Lib "iup.dll" (string *buffer) as string
! IupVersion          Lib "iup.dll" () as string
! IupVersionDate      Lib "iup.dll" () as string
! IupVersionNumber    Lib "iup.dll" () as sys
! IupSetLanguage      Lib "iup.dll" (string *lng)
! IupGetLanguage      Lib "iup.dll" () as string

! iupDrawCreateCanvas Lib "iup.dll" (Ihandle *ih) as sys
! iupDrawKillCanvas   Lib "iup.dll" (sys *dc)
! iupDrawFlush        Lib "iup.dll" (sys *dc)
! iupDrawUpdateSize   Lib "iup.dll" (sys *dc)
! iupDrawGetSize      Lib "iup.dll" (sys *dc, *w, *h)
! iupDrawLine         Lib "iup.dll" (sys *dc, x1, y1, x2, y2, byte r, g, b, sys style)
! iupDrawRectangle    Lib "iup.dll" (sys *dc, x1, y1, x2, y2, byte r, g, b, sys style)
! iupDrawArc          Lib "iup.dll" (sys *dc, x1, y1, x2, y2, double a1, a2, byte r, g, b, sys style)
! iupDrawPolygon      Lib "iup.dll" (sys *dc, *points, count, byte r, g, b, sys style)
! iupDrawText         Lib "iup.dll" (sys *dc, string *text, sys len, x, y, byte r, g, b, string *font)
! iupDrawImage        Lib "iup.dll" (sys *dc, string *name, sys make_inactive, x, y, *img_w, *img_h)
! iupDrawSetClipRect  Lib "iup.dll" (sys *dc, x1, y1, x2, y2)
! iupDrawResetClip    Lib "iup.dll" (sys *dc)

! iupDrawRectangleInvert  Lib "iup.dll" (sys *dc, x1, y1, x2, y2)
! iupDrawParentBackground Lib "iup.dll" (sys *dc)

Function quit_cb() as sys 
Function = IUP_CLOSE 
End Function 
 
Sub AddChild(sys *parent, *child) 
    IupAppend parent,child 
    IupRefresh parent 
End Sub 
 
Function Create (string Value ,Attr ,sys parent) as sys 
sys hwnd 
hWnd = IupCreate(Value) 
if hwnd   
if Len(Attr) 
   IupSetAttributes(hwnd,Attr) 
End if 
if parent 
   AddChild parent,hwnd 
End if     
Return hwnd   
End if     
end function 
 
sys canvas, width, height

Function Main() as sys 
IupOpen(0,0)
win = Create("dialog","TITLE=IUP*TEST*PETER, SIZE=300x200",0) 
iupShowXY *win,380,180 
canvas = IupDrawCreateCanvas *win
iupDrawGetSize *canvas, *width, *height 
iupDrawRectangle *canvas, 10, 10, 40, 40, 255, 0, 0, 0
iupDrawRectangle *canvas, 50, 10, 90, 40, 255,255,0, 1
iupDrawRectangle *canvas, 100,10, 140,40, 255,0,255, 2
iupDrawLine *canvas, 0, 100, &width, 100, 0,255,0, 2 
iupDrawFlush *canvas
iupMainLoop() 
iupDrawKillCanvas *canvas
iupClose() 
End Function 
 
Main()
Title: Re: need O2 IUP translation
Post by: jcfuller on August 10, 2012, 05:53:36 AM

Peter's code  compiles and runs fine here with the iup.dll I mentioned above.

Now the question is why do both work??

I see no cdecl in Peter's code

James


X
Title: Re: need O2 IUP translation
Post by: Charles Pegge on August 10, 2012, 08:43:03 AM
Glad it works now, James.

You can get away with not using cdecl if certain conditions are met to avoid stack overflow.

1 the calls are made inside an o2 procedure.

2 the calls are not iterated or have very few iterations.

If the call has no parameters then there are no restrictions.

Old parameters will accumulate on the stack, but the O2 procedures epilog will restore the stack pointer,  to its correct value.


Charles