Author Topic: Working with IUP  (Read 13289 times)

0 Members and 2 Guests are viewing this topic.

Arnold

  • Guest
Re: Working with IUP
« Reply #30 on: September 04, 2016, 02:54:11 AM »
Hello,

this is my solution for IupWebbrowser() so far. Unfortunately something is still missing so I am hesitating a little bit.
...

Edit: deleted. I submitted the corrected code in a later message

.
« Last Edit: September 05, 2016, 12:06:59 PM by Arnold »

Aurel

  • Guest
Re: Working with IUP
« Reply #31 on: September 04, 2016, 07:00:44 AM »
hi arnold
where i can find iupweb.dll ?
or do you can put it in attachment.

thanks...
...and friendly suggestion never put 3party dll-s into system32 folder  ;)

i also found this error
Arnold i download whole iup package
and what exactly this program need?


.
« Last Edit: September 04, 2016, 07:30:30 AM by Aurel »

Arnold

  • Guest
Re: Working with IUP
« Reply #32 on: September 04, 2016, 09:14:41 AM »
Hi Aurel,

...

The problem is that Iupweb.dll calls Iupole.dll and librarypath cannot not process this fully (or I do it wrong).
...

Roland
« Last Edit: September 05, 2016, 12:09:49 PM by Arnold »

Aurel

  • Guest
Re: Working with IUP
« Reply #33 on: September 04, 2016, 10:21:31 AM »
Hi Arnold
Thanks for zip..i will download and see what is inside.
Well about paths i am not sure ,,,because i never use anything from folder projects
in fact i have one separate folder called o2Mini where i have oxygen compiler few include files
my new interpreter and some GUI programs which use my awinh.inc include file.
For iup-case  i add new subfolder into this one and try to compile...
so i will see...  :)   

Aurel

  • Guest
Re: Working with IUP
« Reply #34 on: September 04, 2016, 10:38:48 AM »
OK
I have again problem with incude iup.h
which invoke also two other headers
iupkey.h and iupdef.h
yes i comment include console.inc  and why this program need console  :o
all your given files are in same folder and i will add this both includes..

.

Arnold

  • Guest
Re: Working with IUP
« Reply #35 on: September 04, 2016, 11:14:34 AM »
Hi Aurel,

I see that you have copied webbrowser.o2bas into folder D:\o2Mini\webbrowser. Then you must copy the contents of projectsB\IUP\IUP into this folder too, namely the dll files, the .h header files and so on. Also iupweb.dll and iupole.dll. Then the first time try to run the program unchanged.

include console.inc is used to see the print statements in a console window. If you do not see the console window then it could be minimized in the task bar. If you click on the Icon in the task bar this window will get into front.

Roland

Arnold

  • Guest
Re: Working with IUP - OT: Set Path
« Reply #36 on: September 05, 2016, 12:27:51 AM »
On second thoughts I will modifiy my (incomplete) webbrowser example so that it can be run in projectsB\IUP. The path for IUP libraries must be added in Windows System Control / User Account.
And this makes sense to me. I use many applications where I must set the path after the installation so that they can be executed e.g. gcc, tcc, bcx etc. Other applications which use dlls are bundled in the same directory.
Therefore nothing is wrong with Oxygenbasic when claiming dependant dlls. It is the logic way how Windows works.

Roland

JRS

  • Guest
Re: Working with IUP
« Reply #37 on: September 05, 2016, 01:14:55 AM »
I put all of Script BASIC's extension module dependency DLLs (IUP, SDL, MySQL, ...) in the bin directory and only have to set one entry in the %PATH% environment variable.

Aurel

  • Guest
Re: Working with IUP
« Reply #38 on: September 05, 2016, 02:06:14 AM »
Sorry Arnold
but this program simply not work for me
it is not clear to me why compiled dll need  include file :o

Do you can compile this program into standalone exe version with required dll-s ?

Arnold

  • Guest
Re: Working with IUP
« Reply #39 on: September 05, 2016, 03:51:47 AM »
Hi Aurel,

attached you will find Aurel_web.zip which contains the files which you will need to run the program. It is not yet complete and not yet finished, (you cannot load a new web page), but it works so far.

Create a folder and copy the files into it or use an already existing folder.

(zip file deleted)

Roland
« Last Edit: September 05, 2016, 12:11:22 PM by Arnold »

Aurel

  • Guest
Re: Working with IUP
« Reply #40 on: September 05, 2016, 08:10:32 AM »
Thanks  :)
So that's it just 3 dll-s no include
why the heck then o2 complain about  ???
maybe because i try to use without console ?
« Last Edit: September 05, 2016, 08:18:03 AM by Aurel »

Arnold

  • Guest
Re: Working with IUP
« Reply #41 on: September 05, 2016, 09:34:03 AM »
Hurrah! I found my bug (as always my weakness using pointers).
I am cleaning up the code and will then upload my results.

Roland

JRS

  • Guest
Re: Working with IUP
« Reply #42 on: September 05, 2016, 09:51:12 AM »
Quote
Hurrah! I found my bug (as always my weakness using pointers).


Arnold

  • Guest
Re: Working with IUP
« Reply #43 on: September 05, 2016, 12:16:56 PM »
Hello,

attached is the modified IupWebbrowser example (webbrowser.zip) containing webbrowser.o2bas, iupweb.dll and iupole.dll. The dlls are intended to be copied into \OxygenBasic\projectsB\IUP\IUP. The environment variable PATH must be set or extended with this folder. Webbrowser.o2bas can be run anywhere on the disk, but if not using the header files of projectsB\IUP\IUP then the includepath statement must be modified.

The IupWebbrowser control works very nice. I can confirm this as I send this message via webbrowser.o2bas.

Roland

Code: OxygenBasic
  1.  
  2. /* IupWebBrowser sample with Oxygenbasic */
  3.  
  4. ' This program can be run anywhere on a data medium with Oxygenbasic,
  5. ' provided there is a path set for the IUP dlls: Iup.dll, Iupole.dll and Iupweb.dll
  6. ' It is assumed there exists \OxygenBasic\projectsB\IUP\IUP\ for the header files
  7. ' otherwise the includepath statement must be corrected.
  8. ' A created executable can run anywhere too, but a path for the IUP dlls must be provided also.
  9.  
  10. $ filename "webbrowser.exe"
  11.  
  12. 'include     "$/inc/RTL32.inc"
  13. include     "$/inc/console.inc"
  14.  
  15. includepath "$/projectsB/iup/iup/"
  16. extern lib "iup.dll" cdecl
  17. include "iup.h"
  18. 'extern lib "iupole.dll" cdecl
  19. extern lib "iupweb.dll" cdecl      
  20. include "iupweb.h"
  21.  
  22. extern cdecl
  23.  
  24.  
  25. function navigate_cb(Ihandle* self, char* url) as int
  26.   printl "NAVIGATE_CB: " & url
  27.   if instr(url, "download") then
  28.     printl "download ignored" & cr
  29.     return IUP_IGNORE
  30.   end if
  31.   return IUP_DEFAULT
  32. end function
  33.                    
  34. function error_cb(Ihandle* self, char* url) as int
  35.   printl "ERROR_CB: " & url & cr
  36.   return IUP_DEFAULT
  37. end function
  38.  
  39. function completed_cb(Ihandle* self, char* url) as int
  40.   printl "COMPLETED_CB: " & url
  41.   return IUP_DEFAULT
  42. end function
  43.  
  44. function newwindow_cb(Ihandle* self, char* url) as int
  45.   printl "NEWWINDOW_CB: " & url & cr
  46.   IupSetAttribute(self, "VALUE", url)
  47.   return IUP_DEFAULT
  48. end function
  49.  
  50. function back_cb(Ihandle* self) as int
  51.   Ihandle* web  = (Ihandle*)IupGetAttribute(self, "MY_WEB")
  52.   IupSetAttribute(web, "BACKFORWARD", "-1")
  53. //  printl "zoom=" & IupGetAttribute(web, "ZOOM") & cr
  54.   return IUP_DEFAULT
  55. end function
  56.  
  57. function forward_cb(Ihandle* self) as int
  58.   Ihandle* web  = (Ihandle*)IupGetAttribute(self, "MY_WEB")
  59.   IupSetAttribute(web, "BACKFORWARD", "1")
  60. //  IupSetAttribute(web, "ZOOM", "200")
  61.   return IUP_DEFAULT
  62. end function
  63.  
  64. function stop_cb(Ihandle* self) as int
  65.   Ihandle* web  = (Ihandle*)IupGetAttribute(self, "MY_WEB")
  66.   IupSetAttribute(web, "STOP", NULL)
  67.   return IUP_DEFAULT
  68. end function
  69.  
  70. function reload_cb(Ihandle* self) as int
  71.   Ihandle* web  = (Ihandle*)IupGetAttribute(self, "MY_WEB")
  72.   IupSetAttribute(web, "RELOAD", NULL)
  73.  
  74.   //TEST:
  75. //  printl "STATUS=" & IupGetAttribute(web, "STATUS") & cr
  76.   return IUP_DEFAULT
  77. end function
  78.  
  79. function load_cb(Ihandle* self) as int
  80.  
  81.   Ihandle *txt  = (Ihandle*)IupGetAttribute(self, "MY_TEXT")  
  82.   Ihandle *web  = (Ihandle*)IupGetAttribute(self, "MY_WEB")  
  83.   IupSetAttribute(web, "VALUE", IupGetAttribute(txt, "VALUE"))
  84.  
  85.   //TESTS:
  86. //  IupSetAttribute(txt, "VALUE", IupGetAttribute(web, "VALUE"))
  87. //  IupSetAttribute(web, "HTML", "<html><body><b>Hello</b>, World!</body></html>")
  88. //  IupSetAttribute(web, "VALUE", "http://www.microsoft.com")
  89.  
  90.   return IUP_DEFAULT
  91. end function
  92.  
  93.  
  94. sub WebBrowserTest()
  95.  
  96.   Ihandle *txt, *dlg, *web
  97.   Ihandle *btLoad, *btReload, *btBack, *btForward, *btStop
  98.  
  99.   IupWebBrowserOpen()              
  100.  
  101.   // Creates an instance of the WebBrowser control
  102.   web = IupWebBrowser()
  103.  
  104.   // Creates a dialog containing the control
  105.   'from bottom up
  106.  'controls
  107.  btBack = IupButton("Back", NULL)
  108.   btForward = IupButton("Forward", NULL)
  109.   txt = IupText("")
  110.   btLoad = IupButton("Load", NULL)
  111.   btReload = IupButton("Reload", NULL)
  112.   btStop = IupButton("Stop", NULL)
  113.  
  114.   'container show horizontally
  115.  hbox = IupHbox(btBack, btForward, txt, btLoad, btReload, btStop, NULL)
  116.   'container show vertically hbox and webbrowser
  117.  vbox = IupVbox(hbox, web, NULL)              
  118.  
  119.   'final dialog                
  120.  dlg = IupDialog(vbox)
  121.  
  122.   IupSetAttribute(dlg, "TITLE", "IupWebBrowser")
  123.   zstring ptr ptxt at txt
  124.   IupSetAttribute(dlg, "MY_TEXT", ptxt)  
  125.   zstring ptr pweb at web
  126.   IupSetAttribute(dlg, "MY_WEB", pweb)
  127.  
  128.   IupSetAttribute(dlg, "RASTERSIZE", "800x600")
  129.   IupSetAttribute(dlg, "MARGIN", "10x10")
  130.   IupSetAttribute(dlg, "GAP", "10")
  131.  
  132.    //IupSetAttribute(pweb, "HTML", "<html><body><b>Hello</b>World!</body></html>")
  133. //   IupSetAttribute(ptxt, "VALUE", "My HTML")
  134. ''  IupSetAttribute(ptxt, "VALUE", "http://www.tecgraf.puc-rio.br/iup")
  135.  IupSetAttribute(ptxt, "VALUE", "http://www.oxygenbasic.org")  
  136. //  IupSetAttribute(ptxt, "VALUE", "file:///D:/tecgraf/iup/html/index.html")
  137.   IupSetAttribute(pweb, "VALUE", IupGetAttribute(ptxt, "VALUE"))
  138.  
  139.   IupSetAttributeHandle(dlg, "DEFAULTENTER", btLoad)
  140.   IupSetAttribute(txt, "EXPAND", "HORIZONTAL")
  141.  
  142.   IupSetCallback(btLoad, "ACTION", @load_cb)
  143.   IupSetCallback(btReload, "ACTION", @reload_cb)
  144.   IupSetCallback(btBack, "ACTION", @back_cb)
  145.   IupSetCallback(btForward, "ACTION", @forward_cb)
  146.   IupSetCallback(btStop, "ACTION", @stop_cb)
  147.  
  148.   IupSetCallback(web, "NEWWINDOW_CB", @newwindow_cb)
  149.   IupSetCallback(web, "NAVIGATE_CB", @navigate_cb)
  150.   IupSetCallback(web, "ERROR_CB", @error_cb)
  151.   IupSetCallback(web, "COMPLETED_CB", @completed_cb)
  152.  
  153.   // Shows dialog
  154.   IupShow(dlg)
  155. end sub
  156.  
  157. sub main()
  158.  
  159.   IupOpen(0,0)
  160.   WebBrowserTest()
  161.   IupMainLoop()
  162.   IupClose()
  163.  
  164. end sub
  165.  
  166. main()


.

Arnold

  • Guest
Re: Working with IUP
« Reply #44 on: September 08, 2016, 04:30:09 AM »
Hi Charles,

Oxygenbasic works very well with IUP. And if I add a path to the IUP dlls there is no problem to work with dependent dlls like iupweb.dll which calls iupole.dll or e.g iupcontrols.dll which is dependent on iupcd.dll, cd.dll, zlib1.dll and freetype6.dll.

As O2 works so nice with IUP 32-bit, I tried to replace IUP.dll with IUP.dll 64-bit on my 64-bit Windows 10. But this time Oxygen refuses to load  IUP.dll no matter if I use a path for the dlls or if I try the way in projectsB\IUP. I tried with Win64_dll10, compiled with VC10 and Win64_dllw4, compiled with mingw.

I am not sure if O2 is not suited for the IUP 64-bit dlls or if there are some additional aspects which must be noted? The IUP download pages states: for 64-bits systems using the x64 standard. I suppose I do not even know the 32-bit standard.

Roland