Alpha Video Training
Results 1 to 10 of 10

Thread: How to change the color of buttons in xdialog

  1. #1
    Member MikeData's Avatar
    Real Name
    Mike Data
    Join Date
    Nov 2008
    Posts
    921

    Default How to change the color of buttons in xdialog

    How to change the colors of buttons background in an xdialog?
    Here is an xdialog code.
    ui_modeless_dlg_box("vn",<<%dlg%
    {xmargin=2}
    {ymargin=1}
    {nocaption}
    {font=a,10,b}
    {color=white on white}
    {'Pick Numbers, enter text then OK};
    {'You will fill the browse};
    {font=a,25,b}
    [.49 vn];
    [.49 vW];
    {font=a,28,b}
    {background=dark blue}
    {color=red on white}
    <15,5 1!1><15,5 2!2><15,5 3!3> ;
    <15,5 4!4><15,5 5!5><15,5 6!6> ;
    <15,5 7!7><15,5 8!8><15,5 9!9> ;
    <15,5 .!.><15,5 0!0>
    {font=a,15,b}
    <15,5 Clear!clear>;
    {font=a,15,b}
    <15,5 OK!OK><15,5Cancel!Cancel><15,5 Reset!reset>;
    %dlg%,<<%code%

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change the color of buttons in xdialog

    The help says

    Note that the background color only applies to textbox controls
    There can be only one.

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: How to change the color of buttons in xdialog

    Mike

    This might be of help

    http://support.alphasoftware.com/Wha...tm#Stylesheets

    It is from the web help on what's new in version 9. Cursor down to Stylesheets for xdialog.

    Tom

    Try this code to change the buttons to Gradient Horizontal white on blue

    Code:
    ui_modeless_dlg_box("vn",<<%dlg%
    {xmargin=2}
    {ymargin=1}
    {nocaption}
    {font=a,10,b}
    {color=white on white}
    {'Pick Numbers, enter text then OK};
    {'You will fill the browse};
    {font=a,25,b}
    [.49 vn];
    [.49 vW];
    {font=a,28,b}
    {style}
    	$Button {
    		font:Arial,15,b;
    		border-shape:SMALL-rounded;
    		line-style:single;
    		line-width:1;
    		line-color:light blue;
    		fill-style:Gradient Horizontal Top;
    		fill-color:pale blue;
    		fill-accent-color:white;
    		}
    	$Button:hover,$Button:focused {
    		font:Arial,18,B;
    		border-shape:small-rounded;
    		line-style:single;
    		line-width:1;
    		line-color:blue;
    		fill-style:Gradient horizontal;
    		fill-color:pale blue;
    		fill-accent-color:White;}
    		}   
    	$frame {
    		fill-style:Gradient horizontal;
    		fill-color:White;
    		fill-accent-color:light Blue;
    		}
    	{endstyle};
    {color=black on white}
    <15,5 1!1><15,5 2!2><15,5 3!3> ;
    <15,5 4!4><15,5 5!5><15,5 6!6> ;
    <15,5 7!7><15,5 8!8><15,5 9!9> ;
    <15,5 .!.><15,5 0!0>
    {font=a,15,b}
    <15,5 Clear!clear>;
    {font=a,15,b} 
    <15,5 OK!OK><15,5Cancel!Cancel><15,5 Reset!reset>; 
    %dlg%,<<%code%
    	if a_dlg_button="Cancel" then
    	    ui_modeless_dlg_close("VN")
    	  
    	end if
    	
    %code%)
    Last edited by Tbaker; 05-10-2010 at 04:57 PM.

  4. #4
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,869

    Default Re: How to change the color of buttons in xdialog

    Tom,

    I didn't see much difference, so I made the following change:
    Code:
    	$Button:hover,$Button:focused {
    		font:Arial,18,B;
    		border-shape:small-rounded;
    		line-style:single;
    		line-width:1;
    		line-color:blue;
    		fill-style:Gradient horizontal;
    		fill-color:Green;
    		fill-accent-color:White;}
    		}
    This gives the "flyover" effect of turning the button green when the mouse is over it.

    Tom

  5. #5
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default Re: How to change the color of buttons in xdialog

    Tom

    Good addition.



    Tom

  6. #6
    Member MikeData's Avatar
    Real Name
    Mike Data
    Join Date
    Nov 2008
    Posts
    921

    Default Re: How to change the color of buttons in xdialog

    Stan Thanks for the clarification.

    These additional codes make the keypad perfect. I still have another issue.
    I like to mention that this set of question originally started at

    http://msgboard.alphasoftware.com/al...ad.php?t=86544

    I think every one in need of a keypad to use with touch screen monitors will be very satisfied.

    Thanks to Stan, Gabriel, Tom Henkel and Tom baker.

    Attached is the app so far.
    There are code in this app in how to tranfer data from the xdialog to variable, fields and browse.
    There is another form Zdialogtestsample in the app with additional samples.
    I hope many will benefit

  7. #7
    "Certified" Alphaholic
    Real Name
    Charlie Crimmel
    Join Date
    Apr 2000
    Location
    West Virginia
    Posts
    1,695

    Default Re: How to change the color of buttons in xdialog

    Mike:
    I am trying to use your key pad as a calculator.
    Any help would be appreciated.
    Thanks
    Charlie Crimmel

    'Date Created: 11-May-2010 06:59:09 AM
    'Last Updated: 11-May-2010 05:18:50 PM
    'Created By : charlie
    'Updated By : charlie
    trace.clear()
    dim global add as N
    dim global add1 as N
    var->add = 0
    var->add1 = 0
    ui_modeless_dlg_box("vn",<<%dlg%
    {xmargin=2}
    {ymargin=1}
    {nocaption}
    {font=a,10,b}
    {color=white on white}
    {'Pick Numbers, enter text then OK};
    {'You will fill the browse};
    {font=a,25,b}
    [.49 vn];
    [.49 vw];
    {font=a,28,b}
    {style}
    $Button {
    font:Arial,15,b;
    border-shape:SMALL-rounded;
    line-style:single;
    line-width:1;
    line-color:light blue;
    fill-style:Gradient Horizontal Top;
    fill-color:pale blue;
    fill-accent-color:white;
    }
    $Button:hover,$Button:focused {
    font:Arial,18,B;
    border-shape:small-rounded;
    line-style:single;
    line-width:1;
    line-color:blue;
    fill-style:Gradient horizontal;
    fill-color:Green;
    fill-accent-color:White;}
    }
    $frame {
    fill-style:Gradient horizontal;
    fill-color:White;
    fill-accent-color:light Blue;
    }
    {endstyle};
    {color=black on white}
    <15,5 1!1><15,5 2!2><15,5 3!3>;
    <15,5 4!4><15,5 5!5><15,5 6!6> <15,5+!+>;
    <15,5 7!7><15,5 8!8><15,5 9!9> <15,5-!->;
    <15,5 .!.><15,5 0!0>
    {font=a,15,b}
    <15,5 Clear!clear> <15,5=!=>;
    {font=a,15,b}
    <15,5 OK!OK><15,5Cancel!Cancel><15,5 Reset!reset>;
    %dlg%,<<%code%
    if a_dlg_button="clear" then
    var->add = 0
    vn=""
    vw=""
    end if
    if a_dlg_button="reset" then
    var->add = 0
    vn=""
    vw=""
    end if
    if a_dlg_button="Cancel" then
    vn=""
    vw=""
    ui_modeless_dlg_close("VN")
    end if

    if a_dlg_button="." then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number .")
    end if
    if a_dlg_button="1" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 1")
    end if
    if a_dlg_button="2" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 2")
    end if

    if a_dlg_button="3" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 3")
    end if

    if a_dlg_button="4" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 4")
    end if

    if a_dlg_button="5" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 5")
    end if

    if a_dlg_button="6" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 6")
    end if

    if a_dlg_button="7" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 7")
    end if

    if a_dlg_button="8" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 8")
    end if

    if a_dlg_button="9" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 9")
    end if

    if a_dlg_button="0" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 0")
    end if

    if a_dlg_button="+" then
    var->add = var->add + val(vn)
    var->vn=""
    trace.WriteLn("Pressed Number +")
    end if

    if a_dlg_button="-" then
    var->add = var->add - val(vn)
    var->vn=""
    trace.WriteLn("Pressed Number -")
    end if

    if a_dlg_button="=" then
    var->add = var->add + val(vn)
    var->vn=""
    trace.WriteLn("Pressed Number =")
    end if
    vw = var->add
    %code%)

  8. #8
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,869

    Default Re: How to change the color of buttons in xdialog

    Charlie,
    your code works for me, except for the smily face instead of ":Pale Blue".
    Code:
    'Date Created: 11-May-2010 06:59:09 AM
    'Last Updated: 11-May-2010 05:18:50 PM
    'Created By : charlie
    'Updated By : charlie
    trace.clear()
    dim global add as N
    dim global add1 as N
    var->add = 0
    var->add1 = 0
    ui_modeless_dlg_box("vn",<<%dlg%
    {xmargin=2}
    {ymargin=1}
    {nocaption}
    {font=a,10,b}
    {color=white on white}
    {'Pick Numbers, enter text then OK};
    {'You will fill the browse};
    {font=a,25,b}
    [.49 vn];
    [.49 vw];
    {font=a,28,b}
    {style}
    $Button {
    font:Arial,15,b;
    border-shape:SMALL-rounded;
    line-style:single;
    line-width:1;
    line-color:light blue;
    fill-style:Gradient Horizontal Top;
    fill-color:Pale blue;fill-accent-color:white;
    }
    $Button:hover,$Button:focused {
    font:Arial,18,B;
    border-shape:small-rounded;
    line-style:single;
    line-width:1;
    line-color:blue;
    fill-style:Gradient horizontal;
    fill-color:Green;
    fill-accent-color:White;}
    }
    $frame {
    fill-style:Gradient horizontal;
    fill-color:White;
    fill-accent-color:light Blue;
    }
    {endstyle};
    {color=black on white}
    <15,5 1!1><15,5 2!2><15,5 3!3>;
    <15,5 4!4><15,5 5!5><15,5 6!6> <15,5+!+>;
    <15,5 7!7><15,5 8!8><15,5 9!9> <15,5-!->;
    <15,5 .!.><15,5 0!0> 
    {font=a,15,b}
    <15,5 Clear!clear> <15,5=!=>;
    {font=a,15,b} 
    <15,5 OK!OK><15,5Cancel!Cancel><15,5 Reset!reset>; 
    %dlg%,<<%code%
    if a_dlg_button="clear" then
    var->add = 0
    vn=""
    vw=""
    end if
    if a_dlg_button="reset" then
    var->add = 0
    vn=""
    vw=""
    end if
    if a_dlg_button="Cancel" then
    vn=""
    vw=""
    ui_modeless_dlg_close("VN")
    end if
    
    if a_dlg_button="." then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number .") 
    end if
    if a_dlg_button="1" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 1") 
    end if
    if a_dlg_button="2" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 2") 
    end if
    
    if a_dlg_button="3" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 3") 
    end if
    
    if a_dlg_button="4" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 4") 
    end if
    
    if a_dlg_button="5" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 5") 
    end if
    
    if a_dlg_button="6" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 6") 
    end if
    
    if a_dlg_button="7" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 7") 
    end if
    
    if a_dlg_button="8" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 8") 
    end if
    
    if a_dlg_button="9" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 9") 
    end if
    
    if a_dlg_button="0" then
    vn=vn+a_dlg_button
    trace.WriteLn("Pressed Number 0") 
    end if
    
    if a_dlg_button="+" then
    var->add = var->add + val(vn)
    var->vn=""
    trace.WriteLn("Pressed Number +")
    end if
    
    if a_dlg_button="-" then
    var->add = var->add - val(vn)
    var->vn=""
    trace.WriteLn("Pressed Number -")
    end if
    
    if a_dlg_button="=" then
    var->add = var->add + val(vn)
    var->vn=""
    trace.WriteLn("Pressed Number =")
    end if
    vw = var->add
    %code%)
    Tom

  9. #9
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: How to change the color of buttons in xdialog

    You could (speaking to myself) simplify this code a tad bit by doing this:

    <15,5 1!x1><15,5 2!x2>
    ....etc.
    Then in the code you would say:
    if left(a_dlg_button,1)="x"
    vn=vn+right(a_dlg_button,1)
    end if

  10. #10
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: How to change the color of buttons in xdialog

    The info Tom gave was great...but I have tested it in v10.5, v11, and Alpha Anywhere and the button hover/button focused does not work for the font size at all. I don't have my other earlier versions available to check them out to see if they even worked back then. Can someone check this aspect out to confirm?

    This is basically the only thread regarding this button style code and all references to this in the help file is not accessible including the links provided here. I did find the same code in the Documentation that is included in v11 regarding new features in v9 but is exactly the same button style code that Tom provided.

    Any information would be great.

    Thanks.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




Similar Threads

  1. Tip - Buttons on an Xdialog in AS
    By Lance Gurd in forum Alpha Five Version 8
    Replies: 1
    Last Post: 04-19-2007, 06:36 PM
  2. Square Buttons in xDialog
    By Mike Thomson in forum Alpha Five Version 6
    Replies: 2
    Last Post: 08-08-2005, 11:57 PM
  3. Disabling Xdialog Buttons
    By Tom Cone Jr in forum Alpha Five Version 6
    Replies: 6
    Last Post: 01-14-2005, 06:17 AM
  4. How would I change font color in Xdialog
    By joannristau in forum Alpha Five Version 5
    Replies: 9
    Last Post: 05-20-2004, 02:37 PM
  5. Condition Color Equations on Buttons
    By Peter Lear in forum Alpha Five Version 5
    Replies: 4
    Last Post: 11-23-2002, 03:32 AM

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
  •