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 


Scrollbar for a window...

 
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: Thu Jan 17, 2002 12:14 pm    Post subject: Scrollbar for a window... Reply with quote

The first is an example of a horizontal scrollbar for the main dialog.
Below it is a simpler routine that uses a TRACKBAR element.

Although you can use DIALOG CREATE with negative numbers,
DIALOG SETPOS will not allow you to move elements below zero
coordinates, so I'm not sure how valuable this program is. You might
try hiding the visible elements, then scrolling others into view. You
also might want to increment the movement x 2 or more.

If you have VDS4, you can add @mousedown() to only move the scroll
bar when the mouse is down. You might also want to build your bar from
TEXT elements (or whatever) to avoid the "activated" button appearance
when clicked.

If you have VDS3, you can change the code to grab/release the mouse
when the scrollbar is clicked, rather than use the mouse location (if you
prefer).

This example grabs the bar whenever the mouse is over it, and clicking
only affects the left and right arrows. I also left the STATUS bar showing
various info (handy for locating mouse/scrollbar XY, etc.).
_______________________________________________________________________________________________________________________________________________________________________________________
Code:

rem -- VDS3 & VDS4 compatible --
OPTION SCALE, 96
OPTION DECIMALSEP, "."
Title By Mac
%%dialogX = 5
DIALOG CREATE,"Test Prog",-1,0,300,220
  DIALOG ADD,STYLE,Style1,Wingdings,8,B,$E0E0E0
  DIALOG ADD,BUTTON,B1,5,%%dialogX,60,20
  DIALOG ADD,TEXT,T1,8,@sum(%%dialogX,65),,," Text Element "
  DIALOG ADD,EDIT,E1,30,%%dialogX,290,20
  DIALOG ADD,COMBO,C1,55,%%dialogX,290,20
  DIALOG ADD,LIST,L1,80,%%dialogX,290,95
  rem -- Scroll buttons --
  DIALOG ADD,TEXT,Bkgrnd,184,0,300,15,,,Style1
  DIALOG ADD,BUTTON,Left,184,0,15,15,@chr(215),,Style1
  DIALOG ADD,BUTTON,Right,184,285,15,15,@chr(216),,Style1
  DIALOG ADD,BUTTON,Slide,184,235,40,15," "
  DIALOG ADD,STATUS,Stat
DIALOG SHOW

:EVLOOP
  DIALOG FOCUS,E1
  REPEAT
    %%MY = @diff(@mousepos(Y), @sum(@winpos("Test Prog", T),22))
    %%MX = @diff(@mousepos(X), @sum(@winpos("Test Prog", L),3))
    rem -- Check Mouse Y --
    if @both(@greater(%%MY, 184), @greater(199, %%MY))
       rem -- Check if Mouse X is over Slide button --
       if @both(@greater(%%MX, @dlgpos(Slide,L)), @greater(@sum(@dlgpos(Slide,L),40), %%MX))
          rem -- Limit Slide movement --
          if @greater(35, %%MX)
             %%MX = 35
          end
          if @greater(%%MX, 265)
             %%MX = 265
          end
          %%dialogX = @diff(265,%%MX)
          GOSUB MoveElements
       end
    end
    DIALOG SET, Stat, dialogX= %%dialogX  Slide L= @dlgpos(Slide,L)  Slide R= @sum(@dlgpos(Slide,L),40)  MX= %%MX  MY= %%MY
    %e = @event()
  UNTIL %e
  goto %e

:SlideBUTTON
  goto EVLOOP

:B1BUTTON
  goto EVLOOP

:LeftBUTTON
  if @greater(%%dialogX, 0)
     %%dialogX = @pred(%%dialogX)
     GOSUB MoveElements
  end
  goto EVLOOP

:RightBUTTON
  if @greater(230,%%dialogX)
     %%dialogX = @succ(%%dialogX)
     GOSUB MoveElements
  end
  goto EVLOOP

:CLOSE
  EXIT

rem ---- GOSUB ROUTINES ----

:MoveElements
  DIALOG SETPOS,Slide,,@diff(245,%%dialogX)
  DIALOG SETPOS,B1,,%%dialogX
  DIALOG SETPOS,T1,,@sum(%%dialogX,65)
  DIALOG SETPOS,E1,,%%dialogX
  DIALOG SETPOS,C1,,%%dialogX
  DIALOG SETPOS,L1,,%%dialogX
  exit


The following is a much simpler routine that uses a trackbar.
Code:

rem -- VDS3 & VDS4 compatible --
OPTION SCALE, 96
OPTION DECIMALSEP, "."
Title By Mac
%%dialogX = 5
DIALOG CREATE,"Test Prog",-1,0,300,200
  DIALOG ADD,STYLE,Style1,,,,BLACK
  DIALOG ADD,BUTTON,B1,5,%%dialogX,60,20
  DIALOG ADD,TEXT,T1,8,@sum(%%dialogX,65),,," Text Element "
  DIALOG ADD,EDIT,E1,30,%%dialogX,290,20
  DIALOG ADD,COMBO,C1,55,%%dialogX,290,20
  DIALOG ADD,LIST,L1,80,%%dialogX,290,90

  DIALOG ADD,TRACKBAR,TBar,175,0,300,20,,,,CLICK
DIALOG SHOW

:EVLOOP
  WAIT EVENT
  goto @event()

:TbarCLICK
  %%dialogX = @prod(@dlgtext(Tbar),5)
  GOSUB MoveElements
  goto EVLOOP

:B1BUTTON
  goto EVLOOP

:CLOSE
  EXIT

rem ---- GOSUB ROUTINES ----

:MoveElements
  DIALOG SETPOS,B1,,%%dialogX
  DIALOG SETPOS,T1,,@sum(%%dialogX,65)
  DIALOG SETPOS,E1,,%%dialogX
  DIALOG SETPOS,C1,,%%dialogX
  DIALOG SETPOS,L1,,%%dialogX
  exit

_________________
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
laurent_H
Contributor
Contributor


Joined: 30 Jun 2001
Posts: 60

PostPosted: Fri Feb 08, 2002 3:34 pm    Post subject: Reply with quote

A new dll is available for dll its includes in Vdsdll3 package calles vdsscr.dll
it put a scrollbar in your dialog

Thanks again mac for all

_________________
Thanks
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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