Author Topic: Question about IUP  (Read 23235 times)

0 Members and 1 Guest are viewing this topic.

JRS

  • Guest
Re: Question about IUP
« Reply #45 on: July 07, 2015, 06:02:46 AM »
I'm posting examples. I get paid for writing production code.

Charles Pegge

  • Guest
Re: Question about IUP
« Reply #46 on: July 07, 2015, 07:41:36 AM »
Hi John,

You should be fast asleep. Are you nocturnal? :)

Mike Lobanovsky

  • Guest
Re: Question about IUP
« Reply #47 on: July 07, 2015, 09:13:01 AM »
Senile insomnia. ;)

Diagnosis not confirmed. :)
« Last Edit: July 08, 2015, 03:10:15 AM by Mike Lobanovsky »

JRS

  • Guest
Re: Question about IUP
« Reply #48 on: July 07, 2015, 11:24:55 AM »
Quote
You should be fast asleep. Are you nocturnal?

I have a client in London that I try to catch some of their day.


JRS

  • Guest
Re: Question about IUP
« Reply #49 on: December 16, 2015, 09:34:31 PM »
Roland,

I got a chance to play with IUP LED files with Swift and I really like the concept and ease of use. Couple that with the IupDialogLayout() function and GUI is a walk in the park.

John

Arnold

  • Guest
Re: Question about IUP
« Reply #50 on: December 17, 2015, 01:11:56 AM »
Hi John,

I also think that using LED and IupDialogLayout() could be very useful for creating applications. After finishing the BCXgui project I will restart the Iup-Oxygen project again (if nobody else does) using Iup.dll and in particular LED and the Iup header files. I am not quite sure how to name the topic then as IUP's version is still changing (in the moment version 3.17) and it does not make sense to start a new section for each update of IUP.

Roland

jcfuller

  • Guest
Re: Question about IUP
« Reply #51 on: December 17, 2015, 08:58:25 AM »
Roland,
  Take a look at reply #4 for another iup approach.

http://www.bcxbasic.com/smf/index.php?topic=922.0

James

JRS

  • Guest
Re: Question about IUP
« Reply #52 on: December 17, 2015, 11:03:57 AM »
Great to see you coding with IUP James!

Here is my IUP LED example in Swift showing how to tie callbacks to the LED definition.

http://www.allbasic.info/forum/index.php?topic=428.msg4598#msg4598


Arnold

  • Guest
Re: Question about IUP
« Reply #53 on: December 18, 2015, 01:27:36 AM »
Hi James,

I know about the two powerful functions Create and AddChild which alone could be used to create almost any control in Iup. But using LED is much easier and more comfortable. It is easy to understand - reading the LED specification and comparing some LED templates should be sufficient. (See John's link above for the LED specification).

The LED file for jfdemo1.o2bas is located here:


http://www.oxygenbasic.org/forum/index.php?topic=1316.msg14321#msg14321


In the latest distribution of OxygenBasic Charles included two examples in folder projectsB\IUP which use led files for creating the controls. (tabs.o2bas and zbox.o2bas). Using Iupload when using led in a separate file or IupLoadBuffer when using LED in a string is sufficient to create the controls on the fly. It demonstrates the power of IUP but also the power of Oxygenbasic. (using header files directly is a powerful feature). As Oxygenbasic can not handle some containers of Iup directly with the Iup header files, create and addchild strategy is used here too via IupCreate, IupAppend and IupRefresh.

The interesting part is that LED files can be used unchanged in any language which can access functions of a foreign dll. And as BCX / BC9 translate to C, there should be no big problem to port these two examples. But I have not yet tried this.


Roland


.
« Last Edit: December 18, 2015, 01:40:30 AM by Arnold »

JRS

  • Guest
Re: Question about IUP
« Reply #54 on: December 18, 2015, 08:02:30 PM »
Roland,

With the Script BASIC version of IUP LED, I'm using a SQLite database to maintain screen definitions. I'm working on a client for a web service. Tons of fun!

John

jcfuller

  • Guest
Re: Question about IUP
« Reply #55 on: December 20, 2015, 11:13:20 AM »
Roland,
  Thanks for all the LED info.
I agree, this is probably the best way to implement especially because I program in several programming languages.

James

JRS

  • Guest
Re: Question about IUP
« Reply #56 on: December 20, 2015, 01:50:42 PM »
The biggest issue this solves is not having to use dynamic Variadic functions to obtain the intended ease of use of the GUI toolkit. I still haven't found any other GUI library that even comes close.




jcfuller

  • Guest
Re: Question about IUP
« Reply #57 on: December 22, 2015, 12:04:19 PM »
Roland,
  This was a bit tricky ;)
James

Code: [Select]
# ==============================================================================
#cardfile
# ==============================================================================
btn_prior = BUTTON[SIZE = 50x15]("<< Prior",NULL)
btn_next =  BUTTON[SIZE = 50x15]("Next >>",NULL)
btn_find =   BUTTON[SIZE = 50x15]("Find",NULL)
btn_add  =   BUTTON[SIZE = 50x15]("Add",NULL)
btn_update =  BUTTON[SIZE = 50x15]("Update",NULL)
btn_delete =  BUTTON[SIZE = 50x15]("Delete",NULL)
btn_print =  BUTTON[SIZE = 50x15]("Print",NULL)
btn_cancel = BUTTON[SIZE = 50x15]("Dismiss",NULL)
# ==============================================================================
id_index = LABEL[]("0 / 0")
entry_company = TEXT[EXPAND = HORIZONTAL](NULL)
entry_last = TEXT[EXPAND = HORIZONTAL](NULL)
entry_first = TEXT[EXPAND = HORIZONTAL](NULL)
entry_add1 = TEXT[EXPAND = HORIZONTAL](NULL)
entry_add2 = TEXT[EXPAND = HORIZONTAL](NULL)
entry_add3 = TEXT[EXPAND = HORIZONTAL](NULL)
entry_city = TEXT[EXPAND = HORIZONTAL](NULL)
entry_state = TEXT[SIZE = 120x](NULL)
entry_zip = TEXT[SIZE = 80x](NULL)
cbo_country = LIST[DROPDOWN=YES, SIZE=100x,VALUE=1](NULL)
entry_phone = TEXT[SIZE=70x](NULL)
entry_fax = TEXT[SIZE=70x](NULL)
entry_email = TEXT[EXPAND = HORIZONTAL](NULL)
entry_www = TEXT[EXPAND = HORIZONTAL](NULL)
entry_comments = TEXT[MULTILINE=YES, EXPAND=YES](NULL)
# ==============================================================================
cardfile = DIALOG[ USERSIZE = 750x563, TITLE = "Card File", RASTERSIZE = 750x563]
(
    VBOX[MARGIN = 5x5]
    (
        HBOX[GAP = 5]
        (
            FILL(),
            LABEL[TITLE = " Record No."](""),id_index
        ),
        FRAME[TITLE = Company]
        (
             entry_company
        ),
        HBOX[GAP = 5]
        (
            FRAME[TITLE = "Last Name"]
            (
                entry_last
            ),
            FRAME[TITLE = "First Name"]
            (
                entry_first
            )
        ),
        FRAME[TITLE = "Address"]
        (
            VBOX[GAP = 5]
            (
                entry_add1,
                entry_add2,
                entry_add3
            )
        ),
        HBOX[GAP = 5]
        (
            FRAME[TITLE = "City"]
            (
                entry_city
            ),
            FRAME[ TITLE = "State / Province"]
            (
                 entry_state
            ),
            FRAME[TITLE = "Zip or Postal Code"]
            (
                entry_zip
            ),
            FRAME[TITLE = "Country"]
            (
                 cbo_country
            )
        ),
        HBOX[GAP = 5]
        (
            FRAME[TITLE = "Phone"]
            (
                entry_phone
            ),
            FRAME[TITLE = "Fax"]
            (
                entry_fax
            ),
            FRAME[TITLE = "Email"]
            (
                entry_email
            ),
            FRAME[TITLE = "www"]
            (
                entry_www
            )
        ),
        FRAME[TITLE = "Comments"]
        (
            TEXT[EXPAND = YES,MULTILINE = YES,NAME = entry_comments](do_nothing)
        ),
        HBOX[GAP = 10]
        (
            FILL(),
            btn_prior,btn_next,btn_find,btn_add,btn_update,btn_delete,btn_print,btn_cancel,
            FILL()
        )
    )
)



JRS

  • Guest
Re: Question about IUP
« Reply #58 on: December 22, 2015, 02:34:53 PM »
Here is what it looks like in Script BASIC. (Ubuntu 14.04 LTS 64 bit)

Comments:
* I think less FRAME controls would be more appealing.
* I had to make the dialog larger to see all the controls. I would let the containers determine the size of the dialog.


Code: Script BASIC
  1. ' James Fuller IUP LED Example
  2.  
  3. IMPORT iup.bas
  4.  
  5. LED = """
  6. # ==============================================================================
  7. #cardfile
  8. # ==============================================================================
  9. btn_prior = BUTTON[SIZE = 50x15]("<< Prior",NULL)
  10. btn_next =  BUTTON[SIZE = 50x15]("Next >>",NULL)
  11. btn_find =   BUTTON[SIZE = 50x15]("Find",NULL)
  12. btn_add  =   BUTTON[SIZE = 50x15]("Add",NULL)
  13. btn_update =  BUTTON[SIZE = 50x15]("Update",NULL)
  14. btn_delete =  BUTTON[SIZE = 50x15]("Delete",NULL)
  15. btn_print =  BUTTON[SIZE = 50x15]("Print",NULL)
  16. btn_cancel = BUTTON[SIZE = 50x15]("Dismiss",NULL)
  17. # ==============================================================================
  18. id_index = LABEL[]("0 / 0")
  19. entry_company = TEXT[EXPAND = HORIZONTAL](NULL)
  20. entry_last = TEXT[EXPAND = HORIZONTAL](NULL)
  21. entry_first = TEXT[EXPAND = HORIZONTAL](NULL)
  22. entry_add1 = TEXT[EXPAND = HORIZONTAL](NULL)
  23. entry_add2 = TEXT[EXPAND = HORIZONTAL](NULL)
  24. entry_add3 = TEXT[EXPAND = HORIZONTAL](NULL)
  25. entry_city = TEXT[EXPAND = HORIZONTAL](NULL)
  26. entry_state = TEXT[SIZE = 120x](NULL)
  27. entry_zip = TEXT[SIZE = 80x](NULL)
  28. cbo_country = LIST[DROPDOWN=YES, SIZE=100x,VALUE=1](NULL)
  29. entry_phone = TEXT[SIZE=70x](NULL)
  30. entry_fax = TEXT[SIZE=70x](NULL)
  31. entry_email = TEXT[EXPAND = HORIZONTAL](NULL)
  32. entry_www = TEXT[EXPAND = HORIZONTAL](NULL)
  33. entry_comments = TEXT[MULTILINE=YES, EXPAND=YES](NULL)
  34. # ==============================================================================
  35. cardfile = DIALOG[ USERSIZE = 750x563, TITLE = "Card File", RASTERSIZE = 750x563]
  36. (
  37.    VBOX[MARGIN = 5x5]
  38.    (
  39.        HBOX[GAP = 5]
  40.        (
  41.            FILL(),
  42.            LABEL[TITLE = " Record No."](""),id_index
  43.        ),
  44.        FRAME[TITLE = Company]
  45.        (
  46.             entry_company
  47.        ),
  48.        HBOX[GAP = 5]
  49.        (
  50.            FRAME[TITLE = "Last Name"]
  51.            (
  52.                entry_last
  53.            ),
  54.            FRAME[TITLE = "First Name"]
  55.            (
  56.                entry_first
  57.            )
  58.        ),
  59.        FRAME[TITLE = "Address"]
  60.        (
  61.            VBOX[GAP = 5]
  62.            (
  63.                entry_add1,
  64.                entry_add2,
  65.                entry_add3
  66.            )
  67.        ),
  68.        HBOX[GAP = 5]
  69.        (
  70.            FRAME[TITLE = "City"]
  71.            (
  72.                entry_city
  73.            ),
  74.            FRAME[ TITLE = "State / Province"]
  75.            (
  76.                 entry_state
  77.            ),
  78.            FRAME[TITLE = "Zip or Postal Code"]
  79.            (
  80.                entry_zip
  81.            ),
  82.            FRAME[TITLE = "Country"]
  83.            (
  84.                 cbo_country
  85.            )
  86.        ),
  87.        HBOX[GAP = 5]
  88.        (
  89.            FRAME[TITLE = "Phone"]
  90.            (
  91.                entry_phone
  92.            ),
  93.            FRAME[TITLE = "Fax"]
  94.            (
  95.                entry_fax
  96.            ),
  97.            FRAME[TITLE = "Email"]
  98.            (
  99.                entry_email
  100.            ),
  101.            FRAME[TITLE = "www"]
  102.            (
  103.                entry_www
  104.            )
  105.        ),
  106.        FRAME[TITLE = "Comments"]
  107.        (
  108.            TEXT[EXPAND = YES,MULTILINE = YES,NAME = entry_comments](do_nothing)
  109.        ),
  110.        HBOX[GAP = 10]
  111.        (
  112.            FILL(),
  113.            btn_prior,btn_next,btn_find,btn_add,btn_update,btn_delete,btn_print,btn_cancel,
  114.            FILL()
  115.        )
  116.    )
  117. )
  118. """
  119. Iup::Open
  120. Iup::LoadBuffer LED
  121. Iup::Show(Iup::GetHandle("cardfile"))
  122. Iup::MLoop
  123. Iup::Close
  124.  

.
« Last Edit: December 22, 2015, 04:47:52 PM by John »

Arnold

  • Guest
Re: Question about IUP
« Reply #59 on: December 23, 2015, 01:54:27 AM »
This would be the version in Oxygenbasic, including the LED in a string. The files are running in projectsB/IUP.

This is the inc file:

Code: [Select]
dim as string cardfile_led = quote

-cardfile-
# ==============================================================================
#cardfile
# ==============================================================================
btn_prior = BUTTON[SIZE = 50x15]("<< Prior", message_cb)
btn_next =  BUTTON[SIZE = 50x15]("Next >>",message_cb)
btn_find =   BUTTON[SIZE = 50x15]("Find",message_cb)
btn_add  =   BUTTON[SIZE = 50x15]("Add",message_cb)
btn_update =  BUTTON[SIZE = 50x15]("Update",message_cb)
btn_delete =  BUTTON[SIZE = 50x15]("Delete",message_cb)
btn_print =  BUTTON[SIZE = 50x15]("Print",message_cb)
btn_cancel = BUTTON[SIZE = 50x15]("Dismiss", cancel_cb)
# ==============================================================================
id_index = LABEL[]("0 / 0")
entry_company = TEXT[EXPAND = HORIZONTAL](NULL)
entry_last = TEXT[EXPAND = HORIZONTAL](NULL)
entry_first = TEXT[EXPAND = HORIZONTAL](NULL)
entry_add1 = TEXT[EXPAND = HORIZONTAL](NULL)
entry_add2 = TEXT[EXPAND = HORIZONTAL](NULL)
entry_add3 = TEXT[EXPAND = HORIZONTAL](NULL)
entry_city = TEXT[EXPAND = HORIZONTAL](NULL)
entry_state = TEXT[SIZE = 120x](NULL)
entry_zip = TEXT[SIZE = 80x](NULL)
cbo_country = LIST[DROPDOWN=YES, SIZE=100x,VALUE=1](NULL)
entry_phone = TEXT[SIZE=70x](NULL)
entry_fax = TEXT[SIZE=70x](NULL)
entry_email = TEXT[EXPAND = HORIZONTAL](NULL)
entry_www = TEXT[EXPAND = HORIZONTAL](NULL)
entry_comments = TEXT[MULTILINE=YES, EXPAND=YES](NULL)
# ==============================================================================
cardfile = DIALOG[ USERSIZE = 750x563, TITLE = "Card File", RASTERSIZE = 750x563]
(
    VBOX[MARGIN = 5x5]
    (
        HBOX[GAP = 5]
        (
            FILL(),
            LABEL[TITLE = " Record No."](""),id_index
        ),
        FRAME[TITLE = Company]
        (
             entry_company
        ),
        HBOX[GAP = 5]
        (
            FRAME[TITLE = "Last Name"]
            (
                entry_last
            ),
            FRAME[TITLE = "First Name"]
            (
                entry_first
            )
        ),
        FRAME[TITLE = "Address"]
        (
            VBOX[GAP = 5]
            (
                entry_add1,
                entry_add2,
                entry_add3
            )
        ),
        HBOX[GAP = 5]
        (
            FRAME[TITLE = "City"]
            (
                entry_city
            ),
            FRAME[ TITLE = "State / Province"]
            (
                 entry_state
            ),
            FRAME[TITLE = "Zip or Postal Code"]
            (
                entry_zip
            ),
            FRAME[TITLE = "Country"]
            (
                 cbo_country
            )
        ),
        HBOX[GAP = 5]
        (
            FRAME[TITLE = "Phone"]
            (
                entry_phone
            ),
            FRAME[TITLE = "Fax"]
            (
                entry_fax
            ),
            FRAME[TITLE = "Email"]
            (
                entry_email
            ),
            FRAME[TITLE = "www"]
            (
                entry_www
            )
        ),
        FRAME[TITLE = "Comments"]
        (
            TEXT[EXPAND = YES,MULTILINE = YES,NAME = entry_comments](do_nothing)
        ),
        HBOX[GAP = 10]
        (
            FILL(),
            btn_prior,btn_next,btn_find,btn_add,btn_update,btn_delete,btn_print,btn_cancel,
            FILL()
        )
    )
)
-cardfile-

The NULLs for the controls can be replaced with the name of the callback functions.

This would be  the code for the o2bas file:

Code: OxygenBasic
  1. $ filename "sample.exe"
  2. 'include "$/inc/RTL32.inc"
  3.  
  4. extern lib "IUP/iup.dll" cdecl
  5. includepath "IUP/"
  6. include "iup.h"
  7.  
  8. end extern  
  9.  
  10. extern cdecl
  11.  
  12. typedef sys Ihandle
  13.  
  14.  
  15. includepath ""
  16. include "cardfile.inc"
  17.  
  18.  
  19.  
  20. sub main()
  21.  
  22.    IupOpen(0,0)
  23.  
  24.    'load string
  25.   err = IupLoadBuffer(cardfile_led)  
  26.    if len(err) then
  27.      IupMessage("LED error", err)
  28.      return
  29.    end if
  30.  
  31.   '
  32.  ' Sets callbacks
  33.  '
  34.  IupSetFunction("cancel_cb", @cancel_cb)
  35.   IupSetFunction("message_cb", @message_cb)  
  36.    
  37.    '
  38.   'Shows dialog and starts iteration
  39.   '
  40.   IupShow(IupGetHandle("cardfile"))
  41.    IupMainLoop()
  42.  
  43.    IupDestroy(IupGetHandle("cardfile"))
  44.  
  45.    IupClose()
  46.  
  47. end sub
  48.  
  49. main()
  50.  
  51. '--------------------------------------
  52.  
  53. function cancel_cb(sys *self)
  54.   IupMessage("Started action", IupGetAttribute(self, "TITLE") & ": Bye-Bye")
  55.   return IUP_CLOSE
  56. end function
  57.  
  58. function message_cb(sys *self)
  59.   return IupMessage("Started action", IupGetAttribute(self, "TITLE"))
  60. end function
  61.  
  62.  


Of course this only serves as a template. There are certainly some more possibilities using IUP / LED with OxygenBasic.

Roland

.