Colored Pushbuttons

  1. 7 months ago

    TJ H

    8 Nov 2019 Testers, Xojo Pro Oregon

    There have been several posts on using a canvas to make a colored pushbutton. There are probably as many variations on this as there are people reading this post. This post provides a simplified version for those who want a quick solution.

    1. Create the canvas in the IDE. I gave it a size of 175 x 40

    2, Paint event:

    g.ForeColor = &cFFCC66 // Cantaloupe
    g.FillRoundRect (0,0,me.width,me.height,me.height,me.height) // give the canvas rounded corners and a color
    g.ForeColor = &c000000 // black
    g.DrawRoundRect (0,0,me.width,me.height,me.height,me.height) // give the canvas a black border
    g.TextSize = 18 // verbiage size
    g.DrawString("Re-load original table",15,27) // verbiage for this pseudo pushbutton

    3. MouseDown event

    RETURN TRUE // must return TRUE for the Mouseup event to work

    4, MouseUp event

    FixedPlotReLoad // method to be executed when the pseudo-pushbutton is clicked

or Sign Up to reply!