$PBExportHeader$w_hoverbutton.srw
forward
global type w_hoverbutton from Window
end type
type p_1 from picture within w_hoverbutton
end type
end forward
type trackmouseevent from structure
unsignedlong cbSize
unsignedlong dwFlags
unsignedlong hwndTrack
unsignedlong dwHoverTime
end type
global type w_hoverbutton from Window
int X=1056
int Y=484
int Width=1312
int Height=396
boolean TitleBar=true
string Title="Hover Button"
long BackColor=78682240
boolean ControlMenu=true
boolean MinBox=true
boolean MaxBox=true
boolean Resizable=true
p_1 p_1
end type
global w_hoverbutton w_hoverbutton
type prototypes
Function Boolean TrackMouseEvent(ref trackmouseevent lpEventTrack)
Library "USER32.DLL"
Function Boolean _TrackMouseEvent(ref trackmouseevent lpEventTrack)
Library "COMCTL32.DLL"
end prototypes
type variables
/*
* Window Messages
*/
constant ulong WM_MOUSEHOVER = 673 //0x02A1
constant ulong WM_MOUSELEAVE = 675 //0x02A3
/*
* Hover Flagss
*/
constant ulong TME_HOVER = 1 // 0x00000001
constant ulong TME_LEAVE = 2 // 0x00000002
constant ulong TME_NONCLIENT = 16 // 0x00000010
constant ulong TME_QUERY = 1073741824 // 0x40000000
constant ulong TME_CANCEL = 2147483648 // 0x80000000
constant ulong HOVER_DEFAULT = 4294967295 // 0xFFFFFFFF
boolean ib_mouseover=false
end variables
on w_hoverbutton.create
this.p_1=create p_1
this.Control[]={this.p_1}
end on
on w_hoverbutton.destroy
destroy(this.p_1)
end on
type p_1 from picture within w_hoverbutton
event mousemove pbm_mousemove
event mousehover ( )
event mouseleave ( )
int X=869
int Y=72
int Width=146
int Height=128
string PictureName="large-exit.bmp"
boolean FocusRectangle=false
boolean OriginalSize=true
end type
event mousemove;trackmouseevent lpEventTrack
if not ib_mouseover then
ib_mouseover = true
lpEventTrack.cbSize = 16 //structure is 4 ulongs which is 16 bytes
lpEventTrack.dwFlags = TME_HOVER + TME_LEAVE
lpEventTrack.hwndTrack = Handle (this)
lpEventTrack.dwHoverTime = 100
//hover time-out (if TME_HOVER was specified in dwFlags), in milliseconds
//if this does not work, try swaping this call with the emulated one below
// TrackMouseEvent(lpEventTrack)
_TrackMouseEvent(lpEventTrack)
end if
end event
event mousehover;Border = true
BorderStyle = StyleRaised!
end event
event mouseleave;Border = false
end event
event other;choose case message.Number
case WM_MOUSEHOVER
this.TriggerEvent("mousehover")
case WM_MOUSELEAVE
ib_mouseover = false
this.TriggerEvent("mouseleave")
end choose
end event
event clicked;close(getparent())
end event
|