Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
prob with crt and IUP (was: How to switch to case sensitive)
#11
CD seems to be http://www.uni-koeln.de/rrzk/software/gr...ng/cd.html

I didn't know about IUP til you posted about it ;), no idea.. i ported the color example, but the callback is never called..

Code:
option explicit
option escape

#include once "iup/iup.bi"

#define NULL 0

'':::::
function ok_cb cdecl () as integer
  dim as Ihandle ptr red_text
  dim as Ihandle ptr green_text
  dim as Ihandle ptr blue_text
  dim as Ihandle ptr color_text
  dim as Ihandle ptr clr
  dim as integer red
  dim as integer green
  dim as integer blue
  
  red_text = IupGetHandle("red_text")
  green_text = IupGetHandle("green_text")
  blue_text = IupGetHandle("blue_text")
  color_text = IupGetHandle("color_text")

  red = IupGetInt(red_text, IUP_VALUE)
  green = IupGetInt(green_text, IUP_VALUE)
  blue = IupGetInt(blue_text, IUP_VALUE)
  
  if(red < 0 or red > 255) then red = 0
  if(green < 0 or green > 255) then green = 0
  if(blue < 0 or blue > 255) then blue = 0

  clr = IupColor(red, green, blue)
  IupSetHandle("color", clr)
  IupSetAttribute(color_text, IUP_BGCOLOR, "color")
  
  return IUP_DEFAULT
end function

'' main  
  dim as Ihandle ptr label
  dim as Ihandle ptr red_label
  dim as Ihandle ptr green_label
  dim as Ihandle ptr blue_label
  dim as Ihandle ptr color_label
  dim as Ihandle ptr red_text
  dim as Ihandle ptr green_text
  dim as Ihandle ptr blue_text
  dim as Ihandle ptr color_text
  dim as Ihandle ptr ok_button
  dim as Ihandle ptr main_dlg

  label = IupLabel("Enter RGB values")
  red_label = IupLabel("Red")
  green_label = IupLabel("Green")
  blue_label = IupLabel("Blue")
  color_label = IupLabel("Color")
  red_text = IupText(NULL)
  green_text = IupText(NULL)
  blue_text = IupText(NULL)
  color_text = IupText(NULL)
  ok_button = IupButton("Apply","ok_act")

  main_dlg = IupDialog _
      ( IupVbox _
         ( IupHbox ( IupFill(), label, IupFill(), NULL), _
           IupHbox _
        ( IupVbox ( IupFill(), red_label, IupFill(), NULL), _
          IupFill(), red_text, NULL _
        ), _
               IupHbox _
              ( IupVbox ( IupFill(), green_label, IupFill(), NULL), _
          IupFill(), green_text, NULL _
        ), _
           IupHbox _
            ( IupVbox ( IupFill(), blue_label, IupFill(), NULL), _
          IupFill(), blue_text, NULL _
        ), _
           IupHbox _
            ( IupVbox ( IupFill(), color_label, IupFill(), NULL), _
          IupFill(), color_text, NULL _
        ), _
               IupHbox ( IupFill(), ok_button, IupFill(), NULL), _
         NULL _
         ) _
      )

  IupSetAttribute(red_text, IUP_NC, "3")
  IupSetAttribute(green_text, IUP_NC, "3")
  IupSetAttribute(blue_text, IUP_NC, "3")
  
  IupSetAttribute(color_text, IUP_BGCOLOR, "0 0 0")
  IupSetAttribute(color_text, IUP_READONLY, IUP_YES)


  IupSetAttributes(main_dlg, "TITLE=IupColor, DEFAULTENTER=ok_button, MAXBOX=NO, MINBOX=NO, RESIZE=NO")
  
  IupSetHandle("main_dlg", main_dlg)
  IupSetHandle("red_text", red_text)
  IupSetHandle("green_text", green_text)
  IupSetHandle("blue_text", blue_text)
  IupSetHandle("color_text", color_text)
  IupSetHandle("ok_button", ok_button)
  
  IupSetFunction("ok_act", @ok_cb)

  IupOpen()

  IupPopup(main_dlg, IUP_CENTER, IUP_CENTER)

  IupMainLoop()
  IupClose()

  end 0
Reply
#12
Sorry to reply that late, was out of town.

I read the iup manual over the weekend and I have to say that the way they are doing the gui stuff is not too bad.

Regarding CD thanks for the link, have to check it out.

Downloaded the newest cvs and saw that you already incorporated the iup include files 8)
Also the zstring datatype was added and is used in the iup inc files.

The color example of yours doesn't work here either.

Hope to be get the newest binary file to compile Tongue
For the time being I'm stuck with the zstring datatype :oops:

EDIT:
added in your code a IupSetAttribute:
Code:
ok_button = IupButton("Apply","ACTION")
  IupSetAttribute(ok_button, "ACTION",  "ok_act")
  IupSetFunction("ok_act", @ok_cb)
but it doesn't work either...

----
hope for a new release of fbc (or nightly builds of the binaries...) to get things straight Tongue
Reply
#13
I added the zstring type because i realized it would be impossible to use pointer type casting with fixed-len's ("string * ptr" looks weird) and because i got tired of copying the byte ptr's to temp strings.. ugh.

Zstrings are like C strings, and you can make pointers and return them (not possible with fixed-len), pass as parameter by ptr (ditto), and PRINT/LEN/PUT/etc won't get lost with BYTE ptr's - len() with zstring's is the real-one, you can assign other strings (*z += "A" ) or chars (*z += asc( "A" )), etc. And they are also safe, no buffer overflows can happen if the max size is known at compile-time (different from C).


I dunno what is the deal the UIP callback, no errors happen, i traced it using a debugger, but the callback is never called, really strange..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)