Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    Join Date
    Dec 2003
    Posts
    891

    More color picker questions

    This is in reference to the final couple of posts in this thread and particularly to TJ's last post.
    TJ and/or WORM
    I have been looking at this hex color thing all day. I have used all the dll's I have found on the forum that pulls a color from a popup color board. Getting the proper hex value is eluding me.
    Some colors give a four digit hex number that confuses AMS.
    For instance, when using WORM's CHCOLOR.DLL in this manner
    Code:
    sColor = DLL.CallFunction("AutoPlay\\Docs\\CHCOLOR.DLL", "SelectColor", wnx..",\"FFFFFF\",\"HEX\",\"192;;192;;192\",\"FALSE\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    TJ posts
    Code:
    --call dll function to pick color
    result = DLL.CallFunction("AutoPlay\\Docs\\CHCOLOR.DLL", "SelectColor", wnx..",\"FFFFFF\",\"HEX\",\"192;;192;;192\",\"TRUE\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    --trim all but the hex field
    result = String.Left(result, String.Find(result, "::", 1, false)-1);
    --put in sentence
    Dialog.Message("result", "[color="..result.."]text['/code']"
    then using the string thing you posted above to get rid of all the extra characters the dll returns, a certain color yellow will give this number #FFFF. Copy and paste that into an input box's background color (or any object that uses hex) and it saves out in AMS as #00FFFF (a blue) instead of #FFFF00 which is the correct color.
    I have been reading all day and it seems like this has been discussed (in 2004), but no final fix.
    Has anyone got a real answer for a popup Color Board that can be configured for HEX, Decimal, and even RGB values that can actually be used in AMS?
    What's wierd is that WORM's colorpicker.dll outputs the HEX value correctly (that yellow comes out #FFFF00). However I need a color board

  2. #2
    Join Date
    Jan 2007
    Posts
    56
    I'm sorry, but I haven't been following this thread and may be speaking out of
    my ^%$&, but would it be possible for you to add the code in your app to
    tack on the extra "00" to the end of #FFFF that you need for it to read
    correctly?

    Just a passing thought.

    Patrick

  3. #3
    Join Date
    Dec 2003
    Posts
    891
    The problem with that is it happens the other way around. It drops the 0's off the front, too.
    so a number like #FFFF could be #00FFFF or it could be #FFFF00. In this case AMS sees it as the #FFFF00, but I have seen it (just today) decide to use #0808 as #808000. If it was always the 00 on the end of the output, you could check for four digits and just add 00 to it. It's not that it's not consistant, as it will always add the extra zeros in the same place anytime a certain four digit number comes up. But it would be impossible to know when or where to add the 00's to every number.

  4. #4
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Here's one I created that works well with AMS. It returns the decimal value. I have used this now for a while and have had no problems.
    Last edited by Dermot; 05-09-2007 at 11:21 PM.
    Dermot

    I am so out of here

  5. #5
    Join Date
    Dec 2003
    Posts
    891
    Thanx Dermot.
    Is there anyway to configure it to get a direct HEX value output?

  6. #6
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Code:
    Is there anyway to configure it to get a direct HEX value output?
    Sorry no. AMS uses Dec values when setting the colors using code at runtime so I didn't see the need.
    Dermot

    I am so out of here

  7. #7
    Join Date
    Dec 2003
    Posts
    891
    Dermot, I am not getting it.
    I have seen a couple of other posts that say that, but most object properties have to have the HEX values manually entered. You can bring up the AMS Color board and add a custom color, but only in RGB. Then it inserts the HEX value when you exit from the color board.
    You can pick the default colors from the color board and when it exits, the HEX value is inserted. But, if it uses the Decimal values at run time, how can you put that into the object properties? If you just put in a known Decimal value, it changes it to a HEX, but it will be some off color. So, the only way to manually enter a custom color into the object properties side panel is to know the HEX value.
    As far as I can tell, the Shape object is the only one that needs a Decimal value. And it gets it's color input from the built in color board, so you can't even manually enter the Decimal value if you already know it.
    I'm totally stumped on this one.

  8. #8
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    When using the property editor panel they are in HEX, but at runtime it seems you can set the colors with Dec. values, well at least it has worked for me. If you look at Input.Setproperties() in the help file it says that color values are numbers. It dosen't say what type. Same for labels etc.

    Are you trying to set colors at design time or runtime? If it is just at design time then there are plenty of color pickers that will give you the color in different formats.
    Dermot

    I am so out of here

  9. #9
    Join Date
    Dec 2003
    Posts
    891
    At design time.
    Not only that, but just to make a color board that will give a HEX output when you create a custom color that can be part of the finished AMS project.
    For the xDialog Message utility, we were using your color board dll to get a color to put into the script when creating the message at run time. Works great.
    But I want to build a small color picker that has some extra color features (palette builder, etc), and want to use that app to set colors in AMS during design time, or even for web page creation in another editor, I am going to need for that color app to output several formats. HEX for AMS and HTML, RGB for other IDE's and Decimal for others. Lua has a math function to format DEC to HEX, but it will not output a full six digit value for all colors. Sometimes just four, and I THINK it could even output just two digits in the right circumstance. When the other digits are left out, they are not always at the end of the number, or the beginning. So when it outputs a four digit value, how do you know what HEX value color it is, or where to add the extra 0's?
    Obviously it's possible to output a properly formatted HEX value, as WORM's colorpicker dll does (also DEC and RGB). But his older ChooseColor dll (the color board one) does not. It outputs a HEX, but it will output the four digit values. Plus, the output includes a bunch of other values that I have to admit, I just don't understand.
    Maybe WORM would be so kind as to update his color board dll to give the same output formats as his colorpicker.dll.

  10. #10
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959

  11. #11
    Join Date
    Dec 2003
    Posts
    891
    Thanx for answering Worm.
    I had read that thread 7-8 times thinking I had missed something.
    #5 has the CHCOLOR.DLL and #13 has the PureBasic source for the dll. But in #9, you have an apz with another dll that is a few hours newer than the one in #5. So I am assuming it is an updated version of the one in #5.
    Using that apz and changing the RGB to HEX in the dll call,
    Code:
    result = DLL.CallFunction("AutoPlay\\Docs\\CHCOLOR.DLL", "SelectColor", wnx..",\"192;;192;;192\",\"HEX\",\"192;;192;;192\",\"FALSE\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    this is the output from the top line Yellow box on the color board (putting result into an input box (Input1)).
    Code:
    #80FFFF:: 192;; 192;; 192;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0
    Again, not understanding why the extra characters are there, or even needed, I just copied the #80FFFF and pasted it into the background color of an input object in it's Object Properties side pane in AMS. The color comes up as a Blue (not yellow) in the Input Object background.
    But, there's more.
    I now choose the Yellow on the 2nd line and the value in the input box is now
    Code:
    #FFFF:: 192;; 192;; 192;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0
    I copy the #FFFF and paste it into the same input object properties pane, and AMS changes it to #00FFFF and it is a slightly darker color of blue.
    I now choose the first Red on the 2nd line of the color board, the output is now
    Code:
    #FF:: 192;; 192;; 192;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0;; 0
    Copy and paste, AMS changed it to #0000FF which is dark Blue. Notice that AMS added the 0's to the front of the string this time. I tried the same again, and AMS added the 0's to the end of the string (#FF0000), which was the correct color Red! The last time I copied and pasted the #FF, AMS added the 0's to the front, which is blue.
    About the extra characters. Not having any explanation in the thread as to why they are needed, I did some string manipulation to get rid of them. I thought I was doing the right thing because in #14, Tigg posted an apz that used the same later compiled dll and changed the dll call to HEX and used string manipulation to get rid of the extra characters and convert it to a Decimal, even tho the dll would output a Decimal value by changing it to DEC.
    Code:
    result = DLL.CallFunction("AutoPlay\\Docs\\CHCOLOR.DLL", "SelectColor", wnx..",\"FFFFFF\",\"HEX\",\"192;;192;;192\",\"FALSE\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    result = tonumber(String.TrimLeft(String.Left(result, String.Find(result, "::", 1, false)-1), "#"),16);
    My manipulation got rid of the extra characters,but didn't change the HEX output of the dll.
    Having a lot of respect for your knowledge and AMS 6.0, I am not sure where the error is. I hope it's with me.
    Oh I noticed that the TRUE and FALSE part of the dll call opens and closes the Custom Color pane. But what will turn on the option button for the pane (Define Custom Colors)? It is disabled in the above code.
    Last edited by Roboblue; 02-18-2007 at 11:58 PM.

  12. #12
    Join Date
    Dec 2003
    Posts
    891
    Just to show what I am trying to do, here is the apz.
    Someone asked me how they could embed a color chooser in their AMS app. So, I was trying to make am example.
    In this one, I am using WORM's colorpicker.dll (not the CHCOLOR.DLL which is a color board) and Dermot's xDialog_Color.dll for the color board. I was trying to show how to do both a picker and a board, separately and integrated (like the one we used in the xDialog Message utility).
    Also, getting a Decimal and Hexadecimal value by selection (and hopefully an RGB value later).
    I have included a shape object with the yellow swatch to show how WORM's colorpicker.dll can give a clean HEX value. (Not so, with the CHCOLOR.DLL color board).
    Attached Files

  13. #13
    Join Date
    Dec 2003
    Posts
    891
    Dang it! Working on too many versions!
    use this one.
    Attached Files

Similar Threads

  1. .NET 1.1 Dependency Script Questions
    By drpepper in forum Setup Factory 7.0
    Replies: 1
    Last Post: 01-03-2006, 02:04 PM
  2. System.GetOSName questions
    By StealthFD in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 04-28-2004, 11:05 PM
  3. quiz template - how to randomize questions
    By sue in forum AutoPlay Media Studio 5.0
    Replies: 8
    Last Post: 03-06-2004, 04:34 AM
  4. Weird Errors
    By RobbyH in forum AutoPlay Media Studio 4.0
    Replies: 9
    Last Post: 01-30-2003, 04:25 AM
  5. Help with randomizing questions and answers in a quiz application
    By TJ_Tigger in forum AutoPlay Media Studio 4.0
    Replies: 36
    Last Post: 11-21-2002, 02:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts