ColorDialog for device

agraham

Expert
Licensed User
Longtime 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!
 

Attachments

  • ColorDialog1.0.zip
    5.3 KB · Views: 360
  • ColorDialog1.0_MergeSource.zip
    2.8 KB · Views: 232
Last edited:

JJM

Active Member
Licensed User
Longtime 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
 

agraham

Expert
Licensed User
Longtime User
Is it possible that the windows is smaller
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.
 

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:

agraham

Expert
Licensed User
Longtime User
Use the Door library. Obj1, Obj2 and Obj3 are Door library Objects
B4X:
   Obj1.New1(False)
   Obj2.New1(False)
   Obj3.New1(False)
   
   Form = "Couleur"
   Red = "Rouge"
   Green = "Vert"
   Blue = "Bleu"
   OK = "D'accord"
   Cancel = "Annulez" 
   Color = Rgb(250, 240, 230)
   
   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)
 

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.
 

Attachments

  • Colordialog.zip
    9.8 KB · Views: 28

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.
 

agraham

Expert
Licensed User
Longtime 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.


I use B4PPC 6.05.
This is the reason. That version of Basic4ppc does not support modules. Try -

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

PatrikL

Member
Licensed User
Try -

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

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...
 

agraham

Expert
Licensed User
Longtime User

PatrikL

Member
Licensed User
agraham my code guru, thanx, 0.9 door library works fine.
 
Top