Subject |
Re: Borderless Button |
From |
Tom <IHaveNoEmail@ddress> |
Date |
Mon, 18 Feb 2019 19:29:39 -0500 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
Toolbtn.txt |
On 2/18/19 4:56 PM, Mark wrote:
> There is a control toolbtn.cc that has all the properties of the pushbutton class but is borderless and has other advantages.
>
> Developed by Jan Hoelterling with contributions from Glenn Johansen, Rick Miller, Ivar Jessen, Rich (from AutoTraker). I have used it for years and it has worked quite well.
>
> I believe you can find references to it in binaries ng.
>
> HTH,
> Mark
>
> 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.
>>
>> Please advise.
>>
>> Michael.
>
*
See attached.
Tom
| // a ToolButton class for forms that resets itself.
//
// Thanks to Glenn Johansen, Rick Miller, Ivar Jessen, Rich (from AutoTraker)
// and Jim Sare for the various ideas and code snippets that made this possible!
// What is different about this class (compared to all the original code from these
// authors): I wanted to have "real" Buttons because I wanted to be able to use the
// "speedtips" and other feature of the button class.
//
// Usage: Set procedure to toolbutton.cc additive
// Drag a toolbtn onto your form.
// Change the upbitmap (of the button)
// Change the speedtip
// Assign an onClick event to the Button
// (as the first action in the onClick, you should reset the button with:
// this.reset()
// )
//
// This control is only for forms with Metric PIXELS
// and works best (at it's current size) with images of 24x24
//
// Jan Hoelterling (jhoelterling@compuserve.com)
//
CLASS toolbtn(oParent) of PushButton(oParent) custom
with (this)
onOpen = Class::TOOLBTN_ONOPEN
onMouseMove = class::ONMOUSEMOVE
onLeftMouseUp = class::reset
left = 0
top = 0
width = 23
height = 23
text = ""
borderstyle = 3 // None
speedbar = true
fontsize = 8
upbitmap = "RESOURCE #856"
*speedtip = "Replace this with your speedtip"
mousePointer = 13 // Hand
endwith
form.btnhardreset = false
this.up = false
function ToolBtn_OnOpen
// for some reason, this does not work as INIT
if type("SetCapture") # "FP"
extern chandle SetCapture(chandle) user32
endif
if type("ReleaseCapture") # "FP"
extern clogical ReleaseCapture(cvoid) user32
endif
if type("SendMessage") # "FP"
extern CLONG SendMessage(CHANDLE,CUINT,CUINT,CLONG) USER32 from "SendMessageA"
endif
// Flat button
SendMessage(this.hWnd,htoi("0406"),16,0)
return
function onMouseMove(flags, col, row)
static bOver = false
if form.btnhardreset
// Raises button
this.up = true
SendMessage(this.hWnd, 0x0406, 16, 2)
this.mousePointer = 13 // Hand
bOver = true
form.btnhardreset=false
else
if col > this.width or row > this.height
ReleaseCapture()
if bOver
//this.borderStyle = 3 // none
// Flat button
this.up = false
SendMessage(this.hWnd, 0x0406, 16, 0)
bOver = false
endif
else
SetCapture(this.hwnd)
if not bOver
//this.borderStyle = 8 // raised
// Raises button
SendMessage(this.hWnd, 0x0406, 16, 2)
this.up = true
this.mousePointer = 13 // Hand
bOver = true
endif
endif
endif
return
function reset
*ReleaseCapture()
SendMessage(this.hWnd,htoi("0406"),16,0)
form.btnhardreset=true
return
endclass
|
|