Announcement

Collapse
No announcement yet.

Need a dialog...

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

  • Scott Turchin
    replied
    Got it!!!!!!!!!!!!!!!!!!!!!!!!

    Thanks guys!!!


    Code:
    #Compile Exe
    #Option Version4
    #Register None
    #Include "Win32api.inc"
    #Include "comdlg32.inc"
    
    Declare Function SelectColor(ByVal hParent As Long, ByVal iStartColor As Long, ByVal iUseExt As Long) As Long
    
    Function PbMain() As Long
    Local lResult As Long
    lResult = SelectColor(0,Val("&h" & "FD35FB"),1)
    MsgBox "#" & Hex$(lResult)
    End Function
    
    Function SelectColor(ByVal hParent As Long, ByVal iStartColor As Long, ByVal iUseExt As Long) As Long
      Local cca As ChooseColorApi
      Dim ccTemp(16) As Static Dword
    
      cca.hinstance    = 0
      cca.lStructSize  = SizeOf(cca)
      cca.lpCustColors = VarPtr(ccTemp(0))  '<-- !!
      cca.Flags        = %CC_RGBINIT Or %CC_FULLOPEN Or  %CC_ANYCOLOR
      If iUseExt = 0 Then cca.Flags = cca.Flags Or %CC_PREVENTFULLOPEN
      cca.hwndowner    = hParent
      cca.rgbResult    = iStartColor
    
      If ChooseColor(cca) Then Function = cca.rgbResult
    
    End Function
    ------------------
    Scott

    Leave a comment:


  • Scott Turchin
    replied
    I'm slowly getting this

    One question, I know I have seen applications that make the color chooser go to extended color mode automatically, is that possible?
    (Filled in later: cca.Flags = %CC_RGBINIT OR %CC_FULLOPEN)

    lResult contains my color, now to convert it to the html tag format with the # on it:

    Code:
    #Compile Exe
    #Option Version4
    #Register None
    #Include "Win32api.inc"
    #Include "comdlg32.inc"
    
    Declare Function SelectColor(ByVal hParent As Long, ByVal iStartColor As Long, ByVal iUseExt As Long) As Long
    
    Function PbMain() As Long
    Local iStartColor As Long
    Local lResult As Long
    lResult = SelectColor(0,iStartColor,%TRUE)
    MsgBox "lResult = " & Format$(lResult)
    
    
    End Function
    
    Function SelectColor(ByVal hParent As Long, ByVal iStartColor As Long, ByVal iUseExt As Long) As Long
      Local cca As ChooseColorApi
      Dim ccTemp(16) As Static Dword
    
      cca.hinstance    = 0
      cca.lStructSize  = SizeOf(cca)
      cca.lpCustColors = VarPtr(ccTemp(0))  '<-- !!
      cca.Flags        = %CC_RGBINIT
      If iUseExt = 0 Then cca.Flags = cca.Flags Or %CC_PREVENTFULLOPEN
      cca.hwndowner    = hParent
      cca.rgbResult    = iStartColor
    
      If ChooseColor(cca) Then Function = cca.rgbResult
    
    End Function
    ------------------
    Scott

    [This message has been edited by Scott Turchin (edited April 30, 2001).]

    Leave a comment:


  • Scott Turchin
    replied
    It's PERFECT! Thank you!

    Now, not meaning to sound ignorant, how do I extract the color and in what format is it when I get it back?

    Does it come from the function itself or one of the parameters?




    Scott

    ------------------
    Scott

    [This message has been edited by Scott Turchin (edited April 30, 2001).]

    Leave a comment:


  • Scott Turchin
    replied
    16 colors?
    What about those type of dialogs that have a rainbow color, you select a spot on that rainbow and then you get a choice of those kind of colors? Perhaps it's a program specific thing in Paint Shop Pro?


    Thanks, this is definitely enough to get me going!


    Scott

    ------------------
    Scott

    Leave a comment:


  • Borje Hagsten
    replied
    i once posted an ownerdrawn color listbox sample, which easily can
    be customized, so you can read ini values and present the listed ones,
    whatever your need is.

    see http://www.powerbasic.com/support/pb...ad.php?t=22893


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

    Leave a comment:


  • Lance Edmonds
    replied
    How about the ChooseColor() common dialog? You can even specify the 16 custom colors in advance.

    There should be a few examples on the BBS... search for "choosecolor".


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Scott Turchin
    started a topic Need a dialog...

    Need a dialog...

    I'm going to build an app with a GUI interface to edit an INI file so things are easier for the administrator using my app...

    Ini file looks like this:

    [Config]
    Extention=mp3
    Template=D:\wwwroot\mp3\tng.html
    FolderImage=/images/folder.gif
    BorderSize=3
    WorkingDir=D:\Files\Secure\Mp3
    VirtualDir=/virtualmp3
    ScriptDir=/mp3

    [HTML Tags]
    VLink Color=#FFFFFF
    ALink Color=#FFFFFF
    Link Color=#FFFFFF
    BGColor=#AAAAFF
    FolderBG=#AAAAFF
    Row2BG=#AAAADD
    Row3BG=#AAAADD
    FileDateBG=#FD35FB
    FileSizeBG=#FD35FB
    TotalBG=#7191F7

    Now, the browse button is easy enough, the file open dialog is easy enough but how to do the colors?


    First I would want a color chooser of some kind, like Paint shop or any good graphics program, and then I want to convert it to the html color...


    Anybody got a good place to start or a good sample I can work with?

    thanks,

    Scott


    ------------------
    Scott
Working...
X