forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Mouseover effects with @wintext()...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Dec 18, 2002 11:37 pm    Post subject: Mouseover effects with @wintext()... Reply with quote

-- VDS3 and VDS4 compatible --

Here's a generic subroutine that uses @wintext() so ya don't
have to keep up with element XY positions. It only works
with elements that have retrievable text though (buttons,
checkboxes, radio buttons). They must also be able to use
STYLES.

It allows as many elements as you want, just add them to
the list, along with the text to check for.

It uses the window handle (var %%hwnd) to check window
position (ya can change that if ya want to hand code in the
window title or class), and 4 vars (%%mo1 thru %%mo4)
that are re-used within the routine to save vars. It also uses
LIST 9.

Sort of a cross between an idea of iMPA's and one of Skit's.
__________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Mouse Over Effects",-1,0,200,155
  %%hwnd = @winexists("Mouse Over Effects")

  DIALOG ADD,STYLE,S1,Arial,10,B
  DIALOG ADD,STYLE,S2,Arial,10,BI,,LTGREEN
  DIALOG ADD,STYLE,S3,Arial,10,BI,,LTBLUE

  DIALOG ADD,BUTTON,B1,5,10,50,24,"Hello",,S1
  DIALOG ADD,BUTTON,B2,5,10,50,24,"Hello",,S2
  DIALOG HIDE,B2

  DIALOG ADD,CHECK,CK1,40,10,,,"This is a check box",,,S1,CLICK
  DIALOG ADD,CHECK,CK2,40,10,,,"This is a check box",,,S2,CLICK
  DIALOG HIDE,CK2

  DIALOG ADD,RADIO,R1,65,10,130,80," Radio Buttons ",Radio 1|Radio 2|Radio 3,,,S1,CLICK
  DIALOG ADD,RADIO,R2,65,10,130,80," Radio Buttons ",Radio 1|Radio 2|Radio 3,,,S3,CLICK
  DIALOG HIDE,R2
DIALOG SHOW

LIST CREATE, 9
rem -- Add element names and exact text to check for --
LIST ADD, 9, "B2|Hello"
LIST ADD, 9, "CK2|This is a check box"
rem -- Radio captions must be added individually --
LIST ADD, 9, "R2| Radio Buttons "
LIST ADD, 9, "R2|Radio 1"
LIST ADD, 9, "R2|Radio 2"
LIST ADD, 9, "R2|Radio 3"

:EVLOOP
  REPEAT
    WAIT ".01"
    GOSUB MouseOver
    %e = @event()
  UNTIL %e
  goto %e

:B1BUTTON
:B2BUTTON
  INFO Hello there!@tab()
  goto EVLOOP

:CK1CLICK
:CK2CLICK
  DIALOG SET, CK1, @dlgtext(CK2)
  goto EVLOOP

:R1CLICK
:R2CLICK
  DIALOG SET, R1, @dlgtext(R2)
  goto EVLOOP

:CLOSE
  EXIT

rem --------- SUB ---------

:MouseOver
  rem -- Positions of top, left, right and bottom of window --
  %%mo1 = @winpos(%%hwnd, T)
  %%mo2 = @winpos(%%hwnd, L)
  rem -- Allow for pixel position inclusion at top and left --
  %%mo3 = @sum(@pred(@winpos(%%hwnd, T)), @winpos(%%hwnd, H))
  %%mo4 = @sum(@pred(@winpos(%%hwnd, L)), @winpos(%%hwnd, W))
  rem -- Don't leave hilighted if mouse is off window --
  if @greater(%%mo1, @mousepos(Y))@greater(%%mo2, @mousepos(X))@greater(@mousepos(Y), %%mo3)@greater(@mousepos(X), %%mo4)
     %%mo1 = 0
     REPEAT
       PARSE "%%mo2", @item(9, %%mo1)
       DIALOG HIDE, %%mo2
       %%mo1 = @succ(%%mo1)
     UNTIL @equal(%%mo1, @count(9))
     exit
  end
  rem -- Check list for current wintext and show hilight if needed --
  LIST SEEK, 9, 0
  if @match(9, @wintext(@winatpoint(@mousepos(X),@mousepos(Y))))
     PARSE "%%mo2", @item(9)
     DIALOG SHOW, %%mo2
     rem -- Hide all others (without this, two may be hilighted) --
     %%mo1 = 0
     REPEAT
       if @equal(@pos(%%mo2, @item(9, %%mo1)), 0)
          PARSE "%%mo3", @item(9, %%mo1)
          DIALOG HIDE, %%mo3
       end
       %%mo1 = @succ(%%mo1)
     UNTIL @equal(%%mo1, @count(9))
  else
     %%mo1 = 0
     REPEAT
       PARSE "%%mo2", @item(9, %%mo1)
       DIALOG HIDE, %%mo2
       %%mo1 = @succ(%%mo1)
     UNTIL @equal(%%mo1, @count(9))
  end
  exit

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group