Hover Objects In PowerBuilder


Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | forward global type w_hoverbutton from window end type type p_2 from picture within w_hoverbutton end type type st_1 from statictext within w_hoverbutton end type type p_1 from picture within w_hoverbutton end type type trackmouseevent from structure 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 integer width = 1294 integer height = 1120 boolean titlebar = true string title = "Hover Objects" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true p_2 p_2 st_1 st_1 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_2=create p_2 this.st_1=create st_1 this.p_1=create p_1 this.Control[]={this.p_2,& this.st_1,& this.p_1} end on on w_hoverbutton.destroy destroy(this.p_2) destroy(this.st_1) destroy(this.p_1) end on type p_2 from picture within w_hoverbutton event mousemove pbm_mousemove event mousehover ( ) event mouseleave ( ) integer x = 805 integer y = 224 integer width = 256 integer height = 192 string picturename = "EditDataGrid!" boolean focusrectangle = false 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();This.Border = True This.BorderStyle = StyleRaised! This.PictureName = "SelectAll!" end event event mouseleave();This.Border = False This.PictureName = "EditDataGrid!" 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 type st_1 from statictext within w_hoverbutton event mousemove pbm_mousemove event mousehover ( ) event mouseleave ( ) integer x = 329 integer y = 672 integer width = 658 integer height = 128 integer textsize = -15 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "text example" boolean focusrectangle = false 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();This.Border = True This.BorderStyle = StyleRaised! end event event mouseleave();This.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 type p_1 from picture within w_hoverbutton event mousemove pbm_mousemove event mousehover ( ) event mouseleave ( ) integer x = 146 integer y = 224 integer width = 256 integer height = 192 string picturename = "FormatDollar!" boolean focusrectangle = false 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();This.Border = True This.BorderStyle = StyleRaised! end event event mouseleave();This.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 |
Find Projects On Github click here
Good Luck!