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 


VDS Tabs and Group example...

 
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: Tue Apr 30, 2002 9:19 pm    Post subject: VDS Tabs and Group example... Reply with quote

Here's an example I put together to show
how to deal with tabs, and using more
than one group in the same location. It's
sort of a "smoke and mirrors" approach,
we create the groups off screen and
show only the one we want (the buttons
and checkboxes don't do anything).
__________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE, "Mac's Tab Example",-1,0,250,195
  DIALOG ADD,TAB,Tabs,1,5,240,190,Tab 1|Tab 2|Tab 3|Tab 4|Hide All

  rem -- Add 4 groups of 3 checkboxes and 1 radio button.
  %x = 1
  REPEAT
    DIALOG ADD,GROUP,Group%x,80,15,220,90,Group %x
    DIALOG ADD,CHECK,Check%xa,100,20,90,14,Checkbox %x A
    DIALOG ADD,CHECK,Check%xb,125,20,90,14,Checkbox %x B
    DIALOG ADD,CHECK,Check%xc,150,20,90,14,Checkbox %x C
    DIALOG ADD,RADIO,Radio%x,94,120,110,70,Radio %x,Start|Stop|Hesitate

    rem -- We have to move each group to a different place
    rem -- off the window so we can make another one.
    DIALOG SETPOS, Group%x, @sum(105, @prod(%x, 90)), 0
    %x = @succ(%x)
  UNTIL @greater(%x, 4)

DIALOG SHOW

goto "Tab 1CLICK"

:EVLOOP
  WAIT EVENT
  goto @event()

:Tab 1CLICK
  %s = 1
  GOSUB Hide_Show
  goto EVLOOP

:Tab 2CLICK
  %s = 2
  GOSUB Hide_Show
  goto EVLOOP

:Tab 3CLICK
  %s = 3
  GOSUB Hide_Show
  goto EVLOOP

:Tab 4CLICK
  %s = 4
  GOSUB Hide_Show
  goto EVLOOP

:Hide AllCLICK
  %s = ""
  GOSUB Hide_Show
  goto EVLOOP

:CLOSE
  EXIT
  STOP

rem --------------------- GOSUB routines ------------------------

:Hide_Show
  rem -- Move each group to different locations
  rem -- off the window and hide them.
  %x = 1
  REPEAT
    DIALOG SETPOS, Group%x, @sum(105, @prod(%x, 90)), 0
    DIALOG HIDE, Group%x
    %x = @succ(%x)
  UNTIL @greater(%x, 4)

  rem -- Position and show only the chosen group.
  if %s
     DIALOG SETPOS, Group%s, 80, 15
     DIALOG SHOW, Group%s
  end
  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
Mac
Professional Member
Professional Member


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

PostPosted: Mon Feb 24, 2003 1:35 pm    Post subject: Reply with quote

Here's a couple of simpler TAB examples, using DIALOG REMOVE
instead of HIDE/SHOW. RADIO elements are used, but the principle
is the same for all controls.

The first is very simple because it has only 2 tabs. You don't
have to determine which tab is active because it's either one
or the other:
__________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE, "Mac's Tab Example",-1,0,200,145
  DIALOG ADD,TAB,Tabs,1,5,190,140,Tab 1|Tab 2
  DIALOG ADD,RADIO,R1,40,20,100,80,"Tab1 Radio", "Test 1|Test 2"
DIALOG SHOW

:EVLOOP
  WAIT EVENT
  goto @event()

:Tab 1CLICK
  DIALOG REMOVE, R2
  DIALOG ADD,RADIO,R1,40,20,100,80,"Tab1 Radio", "Test 1|Test 2"
  goto EVLOOP

:Tab 2CLICK
  DIALOG REMOVE, R1
  DIALOG ADD,RADIO,R2,40,40,100,80,"Tab2 Radio", "Test 1|Test 2"
  goto EVLOOP

:CLOSE
  EXIT

The second one is slightly more complicated. Since there are more
than two TABS, we must keep track of which tab is active to avoid
errors (for large programs, ya might wanna use a list or a field
separated single var to keep track).
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE, "Mac's Tab Example",-1,0,200,145
  DIALOG ADD,TAB,Tabs,1,5,190,140,Tab 1|Tab 2|Tab 3
  DIALOG ADD,RADIO,R1,40,20,100,80,"Tab1 Radio", "Test 1|Test 2"
DIALOG SHOW

rem -- vars to track active tab --
%%t1 = 1
%%t2 = ""
%%t3 = ""

:EVLOOP
  WAIT EVENT
  goto @event()

:Tab 1CLICK
  GOSUB RemoveControls
  DIALOG ADD,RADIO,R1,40,20,100,80,"Tab1 Radio", "Test 1|Test 2"
  %%t1 = 1
  goto EVLOOP

:Tab 2CLICK
  GOSUB RemoveControls
  DIALOG ADD,RADIO,R2,40,40,100,80,"Tab2 Radio", "Test 1|Test 2"
  %%t2 = 1
  goto EVLOOP

:Tab 3CLICK
  GOSUB RemoveControls
  DIALOG ADD,RADIO,R3,40,60,100,80,"Tab3 Radio", "Test 1|Test 2"
  %%t3 = 1
  goto EVLOOP

:CLOSE
  EXIT

rem ----------------------- SUBS -----------------------

:RemoveControls
  if %%t1
     DIALOG REMOVE, R1
     %%t1 = ""
  end
  if %%t2
     DIALOG REMOVE, R2
     %%t2 = ""
  end
  if %%t3
     DIALOG REMOVE, R3
     %%t3 = ""
  end
  exit

Cheers, Mac Smile

_________________
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