Subject |
Re: Borderless Button |
From |
Mervyn Bick <invalid@invalid.invald> |
Date |
Sun, 17 Feb 2019 14:04:21 +0200 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
flat_button.wfm |
On 2019-02-17 9:37 AM, Michael wrote:
> Hi Guys,
>
> Is there some way we can make the button completely borderless?
> It seems if you put it on a blank canvass and select none as the border it still have a slight line on the right and bottom. I would like to have it completely borderless so that I can blend it in with images but still have all the button characteristics.
Yes but there are conditions and limitations.
In the form's form_onOpen event handler add
if type("SendMessageA") # "FP"
extern clong SendMessageA(chandle, cint, cword, clong) user32
endif
#define TB_MARKBUTTON 0x406
#define TB_BUTTON_IDENTIFIER 0x10
#define TB_FALSE 0
#define TB_TRUE 1
SendMessageA(this.pushbutton1.hWnd,TB_MARKBUTTON,TB_BUTTON_IDENTIFIER,TB_FALSE)
//Send the message to all pushbuttons you want to appear flat
Each pushbutton must have it's systemTheme property set false.
If you set the pushbutton's speedBar property true the user can't tab to it.
If you leave the pushbutton's speedBar property false (the default) the
user can tab to the control but a dotted box appears on the pushbutton
when it has focus.
A little example is attached.
Mervyn.
| ** END HEADER -- do not remove this line
//
// Generated on 2019-02-17
//
parameter bModal
local f
f = new flat_buttonForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class flat_buttonForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 16.0
left = 52.5714
top = 1.1364
width = 40.0
text = ""
systemTheme = true
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
systemTheme = false
height = 1.0909
left = 12.0
top = 1.0
width = 15.2857
text = ""
borderStyle = 4 // Single
endwith
this.PUSHBUTTON2 = new PUSHBUTTON(this)
with (this.PUSHBUTTON2)
onClick = class::PUSHBUTTON2_ONCLICK
systemTheme = false
height = 1.0909
left = 12.0
top = 4.5
width = 15.2857
text = ""
speedBar = true
borderStyle = 4 // Single
endwith
this.PUSHBUTTON3 = new PUSHBUTTON(this)
with (this.PUSHBUTTON3)
height = 1.0909
left = 12.0
top = 8.0
width = 15.2857
text = "Pushbutton3"
endwith
this.RADIOBUTTON1 = new RADIOBUTTON(this)
with (this.RADIOBUTTON1)
onChange = class::RADIOBUTTON1_ONCHANGE
height = 1.0909
left = 12.0
top = 11.5
width = 15.7143
text = "Show borders"
group = true
value = true
endwith
this.RADIOBUTTON2 = new RADIOBUTTON(this)
with (this.RADIOBUTTON2)
height = 1.0909
left = 12.0
top = 14.0
width = 15.7143
text = "Hide borders"
endwith
this.TEXTLABEL1 = new TEXTLABEL(this)
with (this.TEXTLABEL1)
height = 1.0
left = 8.0
top = 1.0909
width = 3.0
text = "*"
fontSize = 14.0
alignHorizontal = 2 // Right
endwith
this.TEXTLABEL2 = new TEXTLABEL(this)
with (this.TEXTLABEL2)
height = 1.0
left = 8.0
top = 4.5
width = 3.0
text = "*"
fontSize = 14.0
alignHorizontal = 2 // Right
endwith
this.TEXTLABEL3 = new TEXTLABEL(this)
with (this.TEXTLABEL3)
height = 1.0
left = 28.0
top = 1.0909
width = 12.0
text = "*"
fontSize = 14.0
endwith
this.TEXTLABEL4 = new TEXTLABEL(this)
with (this.TEXTLABEL4)
height = 1.0
left = 28.0
top = 4.5
width = 12.0
text = "*"
fontSize = 14.0
endwith
function PUSHBUTTON1_onClick()
? 'PB1 clicked'
return
function PUSHBUTTON2_onClick()
? 'PB2 clicked'
return
function RADIOBUTTON1_onChange()
if this.value = true
form.pushbutton1.borderStyle = 4
form.pushbutton2.borderStyle = 4
else
form.pushbutton1.borderStyle = 3
form.pushbutton2.borderStyle = 3
endif
return
function form_onOpen()
if type("SendMessageA") # "FP"
extern clong SendMessageA(chandle, cint, cword, clong) user32
endif
#define TB_MARKBUTTON 0x406
#define TB_BUTTON_IDENTIFIER 0x10
#define TB_FALSE 0
#define TB_TRUE 1
SendMessageA(this.pushbutton1.hWnd,TB_MARKBUTTON,TB_BUTTON_IDENTIFIER,TB_FALSE)
SendMessageA(this.pushbutton2.hWnd,TB_MARKBUTTON,TB_BUTTON_IDENTIFIER,TB_FALSE)
clear
return
endclass
|
|