Announcement

Collapse
No announcement yet.

Changing Colors in Dialog Window

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

  • Changing Colors in Dialog Window

    I have what is probably a pretty simple problem. I am using PB/DLL6 DDT tools.
    What I want to do is print a CONTROL ADD TEXTBOX in a different color. I am using CONTROL ADD LABEL to print the description and CONTROL ADD TEXTBOX with the %ES_READONLY style. When you use the %ES_READONLY style the test in the textbox is the same color as the label text and can be difficult to seperate from the label. I would like to print the textbox data in a different color to make it stand out better.
    Right now what I am doing is printing the label with a : at the end, i.e.
    (label) (data)
    Name : Tom Driver


  • #2
    tom --
    read
    technique, described by dave, works fine with readonly also.

    i found my training code. after small edition, it looks so
    <font face="courier new, courier" size="3"><pre>
    #compile exe
    #register none

    #include "win32api.inc"

    %id_label1 = 101
    %id_label2 = 102
    %id_text1 = 201

    callback function hdlg_cb()
    dim brushltbr as static long, brushwhite as static long, brushblue as static long

    select case cbmsg
    case %wm_initdialog
    local lb as logbrush
    lb.lbstyle = %bs_solid
    lb.lbcolor = &h80c0ff: brushltbr = createbrushindirect(lb)
    lb.lbcolor = %white : brushwhite = createbrushindirect(lb)
    lb.lbcolor = %blue : brushblue = createbrushindirect(lb)
    function = %true

    case %wm_destroy
    deleteobject brushltbr: deleteobject brushwhite: deleteobject brushblue

    case %wm_ctlcolordlg ' return the handle of the dialog background brush.
    function = brushltbr

    case %wm_ctlcolorstatic ', %wm_ctlcoloredit
    select case getdlgctrlid(cblparam)
    case %id_text1
    settextcolor cbwparam, %blue
    setbkcolor cbwparam, %white
    function = brushwhite
    case %id_label1
    setbkmode cbwparam, %transparent
    settextcolor cbwparam, &h80
    function = brushltbr
    case %id_label2
    settextcolor cbwparam, %white
    setbkcolor cbwparam, %blue
    function = brushblue
    end select
    end select
    end function

    function pbmain ()

    local hdlg as long
    dialog new 0 ,"stupid sample",0,0, 105, 90, %ds_center or %ws_sysmenu to hdlg
    control add label, hdlg, %id_label1, "very important", 10, 5, 80, 10, %ss_right
    control add label, hdlg, %id_label2, "c o n t e n t s", 10, 20, 80, 10, %ss_center
    control add textbox, hdlg, %id_text1,"1. not nice" + $crlf + "2. colors, fonts" + $crlf + "3. pardon", 9, 35, 82, 30, %es_wantreturn or %es_multiline or %es_readonly, %ws_ex_clientedge
    dialog show modal hdlg, call hdlg_cb

    end function
    [/CODE]

    [this message has been edited by semen matusovski (edited january 24, 2000).]

    Comment


    • #3
      Thank you Semen. I guess I should of looked for a previous reply a little harder. Again thanks.

      Tom

      Comment

      Working...
      X