Announcement

Collapse
No announcement yet.

Color picker dialog Title

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Color picker dialog Title

    Every once in a while things get a little slow up here and I get a little curious about how to do something....

    Those times are here

    As you know the color picker dialog box has a title already, it says "Color"..
    Blah, that's boring, I'd like to put a unique title so the user knows WhICH color they are picking for...

    Alas there is no option in the api:

    Code:
    Type CHOOSECOLORAPI
        lStructSize    As Dword
        hwndOwner      As Long
        hInstance      As Long
        rgbResult      As Dword
        lpCustColors   As Dword Ptr
        Flags          As Dword
        lCustData      As Long
        lpfnHook       As Dword
        lpTemplateName As Asciiz Ptr
    End Type
    ------------------
    Scott
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    hi scott

    here is a quick hack that works on a win98 se.


    it's based on : http://www.powerbasic.com/support/pb...ad.php?t=22592
    (by eric pearson)

    Code:
     
    
    
    $dim all
    $register none
    $compile exe
    
    $include "win32api.inc"
    $include "comdlg32.inc"
    
    function hookproc(byval hdlg as long ,byval uimsg as dword,byval  wparam as long,byval  lparam as long) as dword
        select case uimsg
               case %wm_initdialog
                    setwindowtext hdlg,"this is my groovy caption"
        end select
                         
                                           
    end function
    
    function pbmain as long
    
        dim colorspec as local choosecolorapi
        dim lresult   as local long
        dim lcounter  as local long
    
        dim lcustomcolor(15) as local long 'array
    
        colorspec.lstructsize  = len(colorspec)
        colorspec.hwndowner    = 0     'handle of owner window.  if 0, dialog appears at top/left.
        colorspec.lpcustcolors = varptr(lcustomcolor(0))
        colorspec.rgbresult    = 255   'set the default color to red (255,0,0)...
        colorspec.lpfnhook = codeptr(hookproc)
      
    
        'try these options one by one, for different effects...
        'colorspec.flags = colorspec.flags or %cc_rgbinit  'tells control to start at default color
        colorspec.flags = colorspec.flags or %cc_fullopen  or %cc_enablehook
        'colorspec.flags = colorspec.flags or %cc_preventfullopen
        
    
        'create a nice selection of colors for the custom colors (optional)...
        randomize timer
        for lcounter = 0 to 15
            lcustomcolor(lcounter) = rnd(0,16777215)  'or rgb(lcounter*16,0,(15-lcounter)*16)
        next
        '(you could also load custom colors from a file, or hard-code them.)
    
        lresult = choosecolor(colorspec)
    
        if lresult = 0 then
            msgbox "you chose the cancel button.",,"color selection demo"
        else
            msgbox "you chose color value &h"+hex$(colorspec.rgbresult,6),,"color selection demo"
        end if
    
        'you can also check then values in the lcustomcolor() array to see if they've been changed.
    
        function = 1
    
    end function

    ------------------
    best regards
    peter scheutz
    Best Regards
    Peter Scheutz

    Comment


    • #3
      Just remember that all common dialogs use localized titles. Sometimes
      "foreign" developers from exotic countries forget this that add their
      own titles, and suddenly all becomes totally wrong for the rest of us.

      PBedit is one - its Open/Save dialogs comes with strange (could be English?)
      titles, like "Open file", where it should say it in plain Swedish, "Öppna fil".
      Don't know what "Open file" means, so main reason why I had to write my own editor..


      ------------------

      Comment


      • #4
        Easy enough to fix, now that we know about it. Please do remember to report any
        such issues so we can address them!

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          To be honest, never thought about it as an "issue" since everything else
          is in Greek - sorry, English in the editor.

          In case you consider it worth dealing with, it is the titles in the
          Open/Save dialogs. Same thing in the Find and Replace dialogs, but
          maybe those have been hard-coded, don't know. If not, it should be
          possible to get them localized too. No big deal though, at least not
          for me. I have my own toy to play with now..


          ------------------


          [This message has been edited by Borje Hagsten (edited May 15, 2001).]

          Comment

          Working...
          X