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 


Checkboxes in a EXTLIST (VDSLISTS.DLL)

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


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sun Dec 22, 2002 11:50 pm    Post subject: Checkboxes in a EXTLIST (VDSLISTS.DLL) Reply with quote

This shows you how to add check boxes to a list element in the
vdslists.dll for VDS.

http://www.vdsworld.com/index.php?page=download&fileid=246

-Garrett

(download the file above which is a zip file. It includes the bmp's
needed for the example below)
Code:
REM    _____________________________________________________
REM   |\___________________________________________________/|
REM   | |                                                 | |
REM   | | SOURCE TITLE:    VDSLISTS; List Checkbox Example| |
REM   | | ------------                                    | |
REM   | | SOURCE AUTHOR:   Garrett R. Hylltun             | |
REM   | | -------------                                   | |
REM   | | DATE:            22 December, 2002              | |
REM   | | ----                                            | |
REM   | | REQUIREMENTS:    VDS 3.x, VDSLISTS.DLL          | |
REM   | | ------------                                    | |
REM   | | SOURCE STATUS:   Public Domain                  | |
REM   | | -------------                                   | |
REM   | | SOURCE DESCRIPTION:                             | |
REM   | | ------------------                              | |
REM   | |   This shows you how to add check boxes to a    | |
REM   | | list element in the vdslists.dll for VDS.       | |
REM   | |                                                 | |
REM   | |   There should be two bmp files with this       | |
REM   | | example, if not, just make two new ones that    | |
REM   | | are 16x16, one with a check, one without.       | |
REM   | | insert and remove list items in a simple way.   | |
REM   | |_________________________________________________| |
REM   |/___________________________________________________\|

  EXTERNAL vdslists.dll
  OPTION Decimalsep,.
  OPTION Fieldsep,|
  EXTLIST Fieldsep,|

  DIALOG CREATE,extLists Checkbox Example,-1,0,150,190,CLASS EXTLISTSCHECK
  EXTLIST WINDOW,#EXTLISTSCHECK
  EXTLIST ADD,LIST,LIST16,0,0,150,190,16,click
  DIALOG SHOW
  EXTLIST LIST,ADD,LIST16,Item 1|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 2|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 3|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 4|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 5|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 6|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 7|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 8|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 9|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 10|@path(%0)checkoff.bmp

:EVLOOP
  WAIT EVENT
  GOTO @event()

:LIST16CLICK
  REM   --- |-------------------------------------------------| ---
  REM   --- |   The following line of code allows us to see   | ---
  REM   --- | where in the list the mouse was clicked.  If    | ---
  REM   --- | near the checkbox, then we set the checkbox,    | ---
  REM   --- | else we skip that part.  First @greater() is    | ---
  REM   --- | left of the check box Second @greater() is      | ---
  REM   --- | right of the check box                          | ---
  REM   --- |-------------------------------------------------| ---
  IF @not(@greater(@sum(@winpos(extLists Checkbox Example,L),2),@mousepos(x))@greater(@mousepos(x),@sum(@winpos(extLists Checkbox Example,L),20)))
    REM   --- |-------------------------------------------------| ---
    REM   --- |   Now we determine which state the checkbox is  | ---
    REM   --- | already in.  We do this by getting the item and | ---
    REM   --- | parsing it so we can get the data and image     | ---
    REM   --- | information apart.  Then we just do an @equal() | ---
    REM   --- | to pick which image we will replace with.       | ---
    REM   --- |-------------------------------------------------| ---
    %B = @extlist(list,item,list16)
    PARSE "%B;%C",%B
    IF @equal(%C,@path(%0)checkoff.bmp)
      EXTLIST LIST,PUT,LIST16,%B|@path(%0)checkon.bmp
    ELSE
      EXTLIST LIST,PUT,LIST16,%B|@path(%0)checkoff.bmp
    END
  END
  GOTO EVLOOP

:CLOSE
  EXIT
Back to top
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Mon Dec 23, 2002 11:13 am    Post subject: Reply with quote

That's a great example! I once made something like that too, but mine used a text like 'Selected: ' or something simulair like that.

With this routine you can get the checked items/index numbers...

Code:
rem Removed all the REM lines...

  EXTERNAL vdslists.dll
  OPTION Decimalsep,.
  OPTION Fieldsep,|
  EXTLIST Fieldsep,|

  DIALOG CREATE,extLists Checkbox Example,-1,0,150,235,CLASS EXTLISTSCHECK
  EXTLIST WINDOW,#EXTLISTSCHECK
  EXTLIST ADD,LIST,LIST16,0,0,150,190,16,click
  DIALOG ADD,BUTTON,bChecked,210,0,150,24,Which are checked?
  DIALOG SHOW

  EXTLIST LIST,ADD,LIST16,Item 1|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 2|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 3|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 4|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 5|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 6|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 7|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 8|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 9|@path(%0)checkoff.bmp
  EXTLIST LIST,ADD,LIST16,Item 10|@path(%0)checkoff.bmp

:EVLOOP
  WAIT EVENT
  GOTO @event()

:LIST16CLICK
  IF @not(@greater(@sum(@winpos(extLists Checkbox Example,L),2),@mousepos(x))@greater(@mousepos(x),@sum(@winpos(extLists Checkbox Example,L),20)))
    %B = @extlist(list,item,list16)
    PARSE "%B;%C",%B
    IF @equal(%C,@path(%0)checkoff.bmp)
      EXTLIST LIST,PUT,LIST16,%B|@path(%0)checkon.bmp
    ELSE
      EXTLIST LIST,PUT,LIST16,%B|@path(%0)checkoff.bmp
    END
  END
  GOTO EVLOOP

:bCheckedBUTTON
extlist list,seek,list16,0
%%text = @extlist(list,text,list16)
list create,9
list assign,9,%%text
%%checkedindex =
%%checkeditem =
%z = 0
repeat
parse "%B;%C",@item(9,%z)
if @equal(@name(%C),checkon)
  if @equal(%%checkedindex,)
    %%checkedindex = %z
   %%checkeditem = %B
   else
   %%checkedindex = %%checkedindex|%z
   %%checkeditem = %%checkeditem|%B
    end
  end
%z = @succ(%z)
until @equal(%z,@count(9))
list close,9
info The following INDEX numbers are checked: @cr()%%checkedindex@cr()@cr()And this are the values of them:@cr()%%checkeditem@cr()@cr()Use the PARSE command to get the individual values...
goto evloop

:CLOSE
  EXIT
Back to top
View user's profile Send private message
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