WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Mouseover Static Control

 Keywords: Mouseover Text Static Vary VaryText Control Hidden Invisible 


#DefineSubRoutine TMOD(TMODhnd,TMODevent,ctrlnum,rsvd1,rsvd2)
   Select    TMODevent
    Case 0
      DialogProcOptions(TMODhnd, 1,500) ;Initialize Timer at .5 of a second intervals.
      Return -1
    Case 1 ;Timer event fired
      If udfMouseOver(TMODhnd,3)==3 ;If the udf returns the same control number we passed it, then mouse is over it
         DialogControlSet(TMODhnd,"VaryText_1",4,"The mouse is currently over the FIRST Static control.")
         DialogControlState(TMODhnd,"VaryText_1",4,1)
         Else
         If udfMouseOver(TMODhnd,4)==4
            DialogControlSet(TMODhnd,"VaryText_1",4,"The mouse is now over the SECOND Static control.")
            DialogControlState(TMODhnd,"VaryText_1",4,1)
            Else
            DialogControlState(TMODhnd,"VaryText_1",3,1)
         EndIf
      EndIf

      Return -1
   EndSelect
#EndSubRoutine

#DefineFunction udfMouseOver(hdlg, ctrlcnt)
  user32 = StrCat(DirWindows(1), 'User32.dll')
  hctrl = DllCall(user32, long:"GetDlgItem", long:hdlg, long:ctrlcnt+99)
  rect = BinaryAlloc(16)
  ; Fill buffer with control coordinates
  DllCall(StrCat(DirWindows(1), "User32.DLL"), long:"GetWindowRect", long:hctrl, lpbinary:rect)
  xx = BinaryPeek4(rect, 0)
  yy = BinaryPeek4(rect, 4)
  ; Is the mouse over the control?
  coords = MouseInfo(3) ; Mouse screen coordinates in pixels.
  mx  = ItemExtract(1, coords, ' ')
  my  = ItemExtract(2, coords, ' ')
  Result = DllCall(user32, long:"PtInRect", lpbinary:rect, long:mx, long:my)
  BinaryFree(rect)
  If Result == 0
     rtn = @FALSE
  Else
     rtn = StrCat(mx-xx, @TAB, my-yy); Convert mouse coords to client coords.
  EndIf
  If rtn<>0
     Return ctrlcnt
  Else
     Return 0
  EndIf
#EndFunction

MouseOverFormat=`WWWDLGED,6.2`

MouseOverCaption=`Test MouseOver Dialog`
MouseOverX=002
MouseOverY=033
MouseOverWidth=168
MouseOverHeight=085
MouseOverNumControls=006
MouseOverProcedure=`TMOD`
MouseOverFont=`DEFAULT`
MouseOverTextColor=`DEFAULT`
MouseOverBackground=`DEFAULT,DEFAULT`
MouseOverConfig=0

MouseOver001=`007,051,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT`
MouseOver002=`119,051,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MouseOver003=`009,011,048,012,STATICTEXT,"StaticText_1",DEFAULT,"1st Static control",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MouseOver004=`009,027,048,012,STATICTEXT,"StaticText_2",DEFAULT,"2nd Static control",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MouseOver005=`065,015,092,018,VARYTEXT,"VaryText_1",MyVariable2,"Vary 2",DEFAULT,5,1,"Microsoft Sans Serif|5632|70|34","255|255|255","128|128|192"`
MouseOver006=`003,067,160,012,STATICTEXT,"StaticText_3",DEFAULT,"Move the mouse over a static control to show a hidden text box.",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MouseOver")


Article ID:   W17750
Filename:   Mouseover Static Control.txt
File Created: 2009:11:17:09:45:12
Last Updated: 2009:11:17:09:45:12