1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

ColorDialog for device

Discussion in 'Additional Libraries' started by agraham, Jul 29, 2008.

  1. agraham

    agraham Expert Licensed User

    The Compact Framework lacks a ColorDialog. Here's one to make up for that lack, it also works on the desktop. Needs .NET 2.0. No help file as it is very simple and is documented in the demo source. No source for merging for the time being as I can't get it to compile for the device.

    EDIT : Source for merging posted. I don't know why I couldn't get it to merge on the device before - finger trouble I guess!
     

    Attached Files:

    Last edited: Jul 29, 2008
  2. Erel

    Erel Administrator Staff Member Licensed User

    Great work (as usual) :sign0188:
    May I have your permission to use it in the device IDE ?
     
  3. agraham

    agraham Expert Licensed User

    Of course, though it's so simple I would have thought you could do much better :)

    Do you want the VS2005 project or source code?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Please send me the source code.
     
  5. JJM

    JJM Active Member Licensed User

    Color dialog

    Agraham,

    Thank you for your dll.
    Is it possible that the windows is smaller because I woul like get on my screen the window of chosing color and an other programm to compare the colors in the both programms?

    Best regards

    JJ M
     
  6. agraham

    agraham Expert Licensed User

    No. On a Pocket PC forms (which can host controls) are always full screen. As far as I know (someone please correct me if they know otherwise) there is no way of overcoming this. The only things that can be displayed smaller are Notifiers and MessageBoxes but they can't host controls.
     
  7. JJM

    JJM Active Member Licensed User

    Thank you Agraham

    JJ M
     
  8. PatrikL

    PatrikL Member Licensed User

    Hi agraham,

    thanx for good ColorDialog. But I want use this dialog in my programm, and my program is multilanguage. So its possible change dll and add possibility to change texts (also name of form) and color of form?

    Example
    colorDialog.Caption = "Hi"
    colorDialog.txtRed = "Red"
    colorDialog.txtGreen = "Green"
    colorDialog.txtBlue = "Blue"
    colorDialog.Color = frmmain.Color

    Thanks.
     
    Last edited: May 26, 2009
  9. agraham

    agraham Expert Licensed User

    Use the Door library. Obj1, Obj2 and Obj3 are Door library Objects
    Code:
    Obj1.New1(False)
       Obj2.New1(
    False)
       Obj3.New1(
    False)
       
       
    Form = "Couleur"
       Red = 
    "Rouge"
       Green = 
    "Vert"
       Blue = 
    "Bleu"
       OK = 
    "D'accord"
       Cancel = 
    "Annulez" 
       Color = Rgb(
    250240230)
       
       Obj1.FromLibrary(
    "Main.ColorDialog""dialog", B4PObject(2))
       Obj1.SetProperty(
    "Text"Form' Form text
      Obj2.CreateNew("System.Drawing.Color" & Obj2.System_Drawing)
      Obj1.SetProperty2(
    "BackColor",Obj2.RunMethod2("FromArgb",Color,"System.Int32")) 'Color
          
       Obj2.Value = Obj1.GetProperty(
    "Controls")
       Obj3.Value = Obj2.GetProperty2(
    "Item"13'Blue
       Obj3.SetProperty("Text", Blue)   
       Obj3.Value = Obj2.GetProperty2(
    "Item"14'Green
       Obj3.SetProperty("Text", Green)
       Obj3.Value = Obj2.GetProperty2(
    "Item"15'Red
       Obj3.SetProperty("Text", Red)
       
       Obj2.Value = Obj1.GetProperty(
    "Menu")
       Obj3.Value = Obj2.GetProperty(
    "MenuItems"
       Obj3.Value = Obj3.GetProperty2(
    "Item"0'OK
       Obj3.SetProperty("Text", OK)
       Obj3.Value = Obj2.GetProperty(
    "MenuItems"
       Obj3.Value = Obj3.GetProperty2(
    "Item"1'Cancel
       Obj3.SetProperty("Text", Cancel)
     
  10. PatrikL

    PatrikL Member Licensed User

    Hi agraham,

    thanks for door code, because I'm not so skilled programmer for using door library.
    I copy your code into your colordialog demo. And doesn't work. I dont know why. Please look on it (or somebody who know how this work) where is mistake.

    Thanks a lot.
     

    Attached Files:

  11. agraham

    agraham Expert Licensed User

    That code you posted works fine on both my desktop and device. In what way does it "not work", do you get an error message or what?
     
  12. PatrikL

    PatrikL Member Licensed User

    Error message:

    An error occured on sub colordialog_translate.

    Line number: 46

    Obj1.FromLibrary("Main.ColorDialog","dialog",B4PObject(2))
    Error description: (this part is in my language, I try translate into english)
    Reference to object not set to instance of object.

    I use B4PPC 6.05.
     
  13. agraham

    agraham Expert Licensed User

    @Everyone - Please don't just say "it doesn't work" :(. Please always tell us in what way it doesn't work with as much other information as you can.


    This is the reason. That version of Basic4ppc does not support modules. Try -

    Obj1.FromLibrary("ColorDialog", "dialog", B4PObject(2))
     
  14. PatrikL

    PatrikL Member Licensed User

    No, still not working. Now B4PP say, that he want module name... :BangHead:

    Error description:
    ObjectName must start with the module name.
    ...

    Maybe its time to upgrade Basic4PPC... :(:(:( Or, please change dll file agraham...
     
  15. agraham

    agraham Expert Licensed User

    It's the Door library that wants the module name. I have looked inside the project you posted and you seem to have the latest version of the Door library (version 1.1) that wants module names but you are using an earlier version of Basic4ppc that doesn't know about modules. Try using version 0.9 of the Door library here http://www.basic4ppc.com/forum/official-updates/2038-door-library-beta-special-library.html
     
  16. PatrikL

    PatrikL Member Licensed User

    agraham my code guru, thanx, 0.9 door library works fine.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice