Author Topic: need O2 IUP translation  (Read 16840 times)

0 Members and 2 Guests are viewing this topic.

jcfuller

  • Guest
need O2 IUP translation
« 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

JRS

  • Guest
Re: need O2 IUP translation
« Reply #1 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.


Aurel

  • Guest
Re: need O2 IUP translation
« Reply #2 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  ::)

Aurel

  • Guest
Re: need O2 IUP translation
« Reply #3 on: August 08, 2012, 12:54:25 PM »
Uff i try translate few exemples from FB but without succses ::)

Charles Pegge

  • Guest
Re: need O2 IUP translation
« Reply #4 on: August 08, 2012, 01:01:05 PM »
Is there an official IUP.DLL?


jcfuller

  • Guest
Re: need O2 IUP translation
« Reply #5 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


jcfuller

  • Guest
Re: need O2 IUP translation
« Reply #6 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



JRS

  • Guest
Re: need O2 IUP translation
« Reply #7 on: August 08, 2012, 05:22:24 PM »
Here 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
« Last Edit: August 08, 2012, 05:52:44 PM by JRS »

Charles Pegge

  • Guest
Re: need O2 IUP translation
« Reply #8 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
« Last Edit: August 09, 2012, 02:29:58 AM by Charles Pegge »

jcfuller

  • Guest
Re: need O2 IUP translation
« Reply #9 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

Charles Pegge

  • Guest
Re: need O2 IUP translation
« Reply #10 on: August 09, 2012, 03:47:09 AM »
Could you show the source please James.

Peter

  • Guest
Re: need O2 IUP translation
« Reply #11 on: August 09, 2012, 04:07:26 AM »
Hi Charles,

Do you mean this ?


X

jcfuller

  • Guest
Re: need O2 IUP translation
« Reply #12 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

Charles Pegge

  • Guest
Re: need O2 IUP translation
« Reply #13 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

jcfuller

  • Guest
Re: need O2 IUP translation
« Reply #14 on: August 09, 2012, 05:14:06 AM »
Charles,
  Same results with your attached dll.

James