Alpha Video Training
Results 1 to 15 of 15

Thread: Xdialog button text colour

  1. #1
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Xdialog button text colour

    Is it possible to have more than one colour for the text on an an xdialog button eg
    This line of text in black
    This line of text in blue
    Thanks
    Terry

  2. #2
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Kenneth
    Join Date
    Dec 2006
    Location
    EU
    Posts
    1,555

    Default Re: Xdialog button text colour

    <{C=Blue}Yes{F=arial,8}{LF}{C=Red} It is>

    Kenneth

  3. #3
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    I use a variable for the text so current code is:-
    button1_label = "This line of text in black(lf)This line of text in blue"
    <*150,4=button1_label!button1>
    This will not seem to accept the additional {code}
    Perhaps you know how.
    Terry

  4. #4
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    This does work
    <*150,5{F=Arial,16}{C=Black}This line of text in black{F=arial,10}{LF}{C=Blue}This line of text in blue{F=arial,10}{LF}{C=Blue}This extra line of text in blue!button1>
    I am using the variables for the button label as these are actually dynamic
    Thanks
    Terry

  5. #5
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    Does anyone know how to use text variables for the label with colour rather than just the text itself.
    Thanks
    Terry

  6. #6
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,082

    Default Re: Xdialog button text colour

    Terry,

    Try this sample

    Code:
    'Dynamic Button Sample - 
    save_text = "Save:$a5_save"
    open_text = "Open:$a5_open"
    button_text = save_text
    
    dim vFlyFmt as c =""
    dim vBttnfmt as c =""
    dim vBttnTxt as c =""
    dim vFlyTxt as c =""
    vBttnTxt = "Find"
    vBttnfmt = "{J=C,C}{C=Yellow White}{F=Arial,9,B}{B=System-ActiveBorder}"+vBttnTxt		'this is default
    vFlyTxt  = "Dynamic find"
    vFlyFmt  = "{J=C,C}{C=dark blue}{F=Arial,9,i}{B=pale yellow}"+"Dynamic find"			'when flyover on button
    
    dlgBody=<<%dlg%
    File: [.64filename];
    {lf};
     <%O={J=LC} {I=:$(:)+1}  {@1,$(:)-1} ; %15,1.5=button_text!save_file>
     <%T=Find...;O= ~~vBttnFmt~~ ;OF= ~~vflyover~~ %15!event1>
     <10,1.5Close>
    %dlg%
    
    dlgEvent=<<%code%
    if a_dlg_button  = "save_file" then
        if button_text = save_text then
            button_text = open_text		'variable text and change it on event
        else
            button_text = save_text
        end if
        a_dlg_button = ""
    end if
    %code%
    
    dlgbody = stritran(dlgbody," ~~vBttnFmt~~ ",vBttnFmt)    '
    dlgbody = stritran(dlgbody," ~~vFlyover~~ ",vFlyFmt)
    result = ui_dlg_box("Bitmap and Text on a Button",dlgBody,dlgEvent)

  7. #7
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    Thanks, but I am trying to get 2 different colours for the text on a button i.e.
    This line of text in black
    This line of text in blue
    This works
    <*150,5{F=Arial,16}{C=Black}This line of text in black{F=arial,10}{LF}{C=Blue}This line of text in blue!button1>
    but rather than fixed text I would like to use variables containing the text, as replacing the fixed text with the variables fails.
    Terry

  8. #8
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,082

    Default Re: Xdialog button text colour

    Code:
    vBttnTxt = "This line of text in black"
    vFlyTxt  = "This line of text in blue"
    vRedTxt = "This line is Red "
    Class_button_label = "{F=Arial,16}{C=Black}"+vBttnTxt+"{LF}{F=arial,10}{C=Blue}"+vFlyTxt+"{LF}{F=arial,10,b}{C=Red}"+vRedTxt
    
    dlgBody=<<%dlg%
    <*150,5{F=Arial,16}{C=Black}This line of text in black{F=arial,10}{LF}{C=Blue}This line of text in blue!button1>;;
     
     
    <150,5=Class_button_label!OK>;
     
    %dlg%
    
    dlgEvent=<<%code%
    if a_dlg_button  = "save_file" then
     
        a_dlg_button = ""
    end if
    %code%
    
    result = ui_dlg_box("Bitmap and Text on a Button",dlgBody,dlgEvent)

  9. #9
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    Worked perfectly - I'm sure i tried this
    Thanks
    Terry

  10. #10
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    Still working on this and now trying to change colour of text rather than button label.
    Here is the example code:-
    titlestring = "Testing Text Colours"
    headingstring = "this heading word wraps at 30 characters"
    text1 = "This text is black - "
    text2 = "This text is blue, but this is failing to wrap"
    headingstring3A = "{B=#234+234+255}{C=Black}" + text1 + "{C=Blue}" + text2


    varC_result = ui_dlg_box(titlestring,<<%dlg%
    {Background=#234+234+255}
    {Region}
    {text=25,14:headingstring};
    {text=%O={@@}%30,8:headingstring3A};
    {lf};
    {font=Arial,18}
    {Endregion};
    %dlg%)
    Unfortunately I cannot get the text to wrap as it normally would.
    Any help?
    Thanks
    Terry

  11. #11
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,082

    Default Re: Xdialog button text colour

    Terry,

    Insert "{LF}" where you need to Break the line. see below similar threads too.

  12. #12
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    John
    In the final version text1 & 2 are dynamic so cannot place a line feed but need the text to wrap automatically
    Thanks

  13. #13
    "Certified" Alphaholic
    Real Name
    John Koh
    Join Date
    Jan 2004
    Location
    Maryland, USA
    Posts
    1,082

    Default Re: Xdialog button text colour

    but need the text to wrap automatically
    - No wrap feature.

  14. #14
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,699

    Default Re: Xdialog button text colour

    If the string in blue is to be dynamic and variable in length then you might need a little string manipulation first that will test the length of the string and the number of words in it. Then you can divide up the string into multiple variables, each no more than 30 chars long and string those vars together to get the text into multiple lines in your formatted text string and display that in the dialog using some event code. Adding a custom function would be good for this...
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  15. #15
    Member
    Real Name
    Terry Morgan
    Join Date
    Nov 2014
    Location
    Essex, England
    Posts
    270

    Default Re: Xdialog button text colour

    Good suggestion, I will give it a try.
    Thanks

Similar Threads

  1. wrap button text in xdialog
    By Mike Wilson in forum Alpha Five Version 11 - Desktop Applications
    Replies: 3
    Last Post: 08-26-2013, 10:43 AM
  2. Using a Variable to select which button in setting font colour on button on a form
    By Dave Booth in forum Alpha Five Version 10 - Desktop Applications
    Replies: 7
    Last Post: 08-03-2013, 10:47 AM
  3. Can I change button colour on button click in grid? If yes, please explain?
    By Suvarchala in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 01-31-2012, 03:18 AM
  4. Set Text colour in Browse
    By Keith Hubert in forum Alpha Five Version 9 - Desktop Applications
    Replies: 18
    Last Post: 09-09-2009, 06:32 AM
  5. Varying text colour in Memo fields
    By dchiass in forum Alpha Five Version 5
    Replies: 14
    Last Post: 07-29-2004, 04:00 PM

Bookmarks

Posting Permissions

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