View previous topic :: View next topic |
Author |
Message |
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Mar 26, 2007 8:19 am Post subject: API question ***Solved*** |
|
|
hi,
can someone help me please to set the checkbox-state in a listview.
i use
Code: |
%X = @SENDMSG(@WINEXISTS(~AccountTable),@SUM($1000,54),0,@SUM($20,$5))
|
for the checkboxes and grid. i get the state with:
Code: | %Z = @name(@fdiv(@SENDMSG(@WINEXISTS(~AccountTable),@SUM($1000,44),@index(AccountTable),$F000),8192))
|
i think @SUM($1000,43) (LVM_SETITEMSTATE) should be the right one but
i don't know how to handle it.
and another question: is there a way to check the checkbox by clicking the item and not the checkbox itself? of cause, if my first question is answered i can do it with the clickevent but maybe there is a direct api-call for that.
thanx
attreus
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 26, 2007 2:05 pm Post subject: Re: API question |
|
|
Attreus,
What are the names of these messages so we don't have to try and look these up @SUM($1000,54) @SUM($1000,44) ????
I have requested this before but please in the future if anyone posts Message ID's please tell us the names so we can look up the documentation for the messages you are trying to send. All Micro$oft documentation uses the names and not the values. If you want you can do this...
Code: |
%%LVM_SETITEMSTATE = @SUM($1000,43)
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 26, 2007 4:46 pm Post subject: |
|
|
attreus,
Ok now I can help you First of all I have attached a small wrapper for the VDS Table element. It's prob. not as extensive as the wrapper that CodeScript built but it will allow you to turn on CheckBoxes for the Table element. Below is some code that once checkboxes are turned on you can get their state.
Code: |
# Checks to see if the check mark is showing...
%%LVM_GETITEMSTATE = 4140
%%LVIS_CUT = 4
%%LVIS_DROPHILITED = 8
%%LVIS_FOCUSED = 1
%%LVIS_SELECTED = 2
%%LVIS_OVERLAYMASK = 3840
%%LVIS_STATEIMAGEMASK = 61440
%x = @SendMsg(@WINEXISTS(~TABLE1),%%LVM_GETITEMSTATE,%%Index,%%LVIS_STATEIMAGEMASK)
if @Equal(%x,4096)
Info Not checked
ElsIf @Equal(%x,8192)
Info Item is checked
End
|
Description: |
Simple Wrapper to extend the VDS Table Element. 03/26/2007 - Added Table Set,Checkbox command 03/26/2007 - Added @Table(Get,CheckBox) function |
|
Download |
Filename: |
utils.dsc |
Filesize: |
9.1 KB |
Downloaded: |
1994 Time(s) |
_________________ Home of
Give VDS a new purpose!
Last edited by vdsalchemist on Mon Mar 26, 2007 7:37 pm; edited 5 times in total |
|
Back to top |
|
|
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Mar 26, 2007 5:09 pm Post subject: |
|
|
thanks for your work dragonsphere,
but i can get the state of a checkbox simply using
%%LVM_GETITEMSTATE = @SUM($1000,44)
(full line see above)
what i need is to set the checkbox-state.
i want if i restart the program the states of the checkboxes to be restored.
can u help?
attreus
ps: how do i have to use your utils-unit?
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 26, 2007 6:27 pm Post subject: |
|
|
attreus,
I have added a new command to the table wrapper code in utils.dsc. Please download the new version.
Code: |
# Added a new command to utils.dsc
# One checks the item
Table Set,CheckBox,TABLE1,%%ItemIndex,1
wait 5
# Zero unchecks the item
Table Set,CheckBox,TABLE1,%%ItemIndex,0
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Mon Mar 26, 2007 6:40 pm Post subject: |
|
|
attreus,
I use images and a hidden column instead of LVM_SETITEMSTATE if check boxes are the only enhancement needed for the Table element. It's just easier for me to track and I don't have to use bitwise functions.
Attached are the bitmaps for the following script.
Here's bit of a dialog I'm building for user controlled network app installs, but the table stuff could help you.
Code: | #-----------------------------------------------------#
# Author: MICHAEL R. ANDERSEN #
# #
# Copyright: Copyright © 2007 Pride Creations #
#-----------------------------------------------------#
#resource add,bitmap,ckbox0.bmp
#resource add,bitmap,ckbox1.bmp
Title Remote Installer
DIALOG CREATE,Remote Installer,-1,0,314,405,ONTOP
DIALOG ADD,STYLE,STYLE1,MS Sans Serif,10,,4E4E4E,WHITE
DIALOG ADD,STYLE,STYLE2,,,B,4E4E4E
DIALOG ADD,LINE,LINE1,1,0,314,383
DIALOG ADD,TEXT,background,7,7,183,16,Select Application(s) to Install
DIALOG ADD,TABLE,TABLE1,27,5,303,314,Application[190]|Status[109],,CLICK
DIALOG ADD,TABLE,TABLEIMG,0,0,0,0
DIALOG ADD,BUTTON,CLOSE,350,220,64,24,CLOSE
DIALOG ADD,BUTTON,ACCEPT,350,29,64,24,ACCEPT
DIALOG ADD,STATUS,STAT
DIALOG SET,STAT,Idle...
# Add images
List add,TABLEIMG,|ckbox0.bmp
List add,TABLEIMG,|ckbox1.bmp
# Get Handle to TABLEIMG ImageList
%%TABLEIMG = @SENDMSG(@WINEXISTS(~TABLEIMG),@SUM($1000,2),1,0)
# Assign TABLEIMG ImageList to TABLE1
# LVM_SETIMAGELIST As LVSIL_SMALL
%x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,3),1,%%TABLEIMG)
# LVM_SETIMAGELIST As LVSIL_STATE
# LVS_EX_SUBITEMIMAGES
%x = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,54),0,$2)
DIALOG SHOW
%X = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,54),0,17)
rem The third column is hidden, use "0" for unchecked and "1" for checked.
List add,table1,Test app1@tab()Not Installed@tab()0|ckbox0.bmp
List add,table1,Test app2@tab()Not Installed@tab()0|ckbox0.bmp
List add,table1,Test app3@tab()Not Installed@tab()0|ckbox0.bmp
List add,table1,Test app4@tab()Not Installed@tab()0|ckbox0.bmp
List add,table1,Test app5@tab()Not Installed@tab()0|ckbox0.bmp
List add,table1,Test app6@tab()Not Installed@tab()0|ckbox0.bmp
%E = @event()
:Evloop
wait event
goto @event()
:TABLE1CLICK
Option fieldsep,@tab()
parse "%%col0;%%col1;%%col2", @item(Table1)
Option fieldsep,|
# Info %%col2
If @equal(%%col2,0)
List put,Table1,%%col0@tab()%%col1@tab()1
%%iImage = 1
Else
List put,Table1,%%col0@tab()%%col1@tab()0
%%iImage = 0
End
#LVITEM Structure for LVM_SETITEMA
#MASK
%%LVIF_IMAGE = $2
#iItem = List item index
%%iItem = @index(Table1)
#ISubItem = use zero based Column ID
%%ISubItem = 0
#state = 0
#stateMask = 0
#pszText = 0
#cchTextMax = 0
#%%iImage
# Create LVITEM
%%LVITEM = @binary(DWORD,%%LVIF_IMAGE)@binary(DWORD,%%iItem)@binary(DWORD,%%iSubItem)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,0)@binary(DWORD,%%iImage)@binary(DWORD,0)
# Apply the image to the table
%%LVM_SETITEMA = @SENDMSG(@WINEXISTS(~TABLE1),@SUM($1000,6),0,%%LVITEM)
# Disgard the Click event caused by %%LVM_SETITEMA
%E = @event()
goto evloop
:ACCEPTBUTTON
info Replace this line with code to process the ACCEPTBUTTON event
goto evloop
:CLOSEBUTTON
:Close
exit |
Description: |
|
Filesize: |
822 Bytes |
Viewed: |
41012 Time(s) |
|
Description: |
|
Filesize: |
822 Bytes |
Viewed: |
41011 Time(s) |
|
|
|
Back to top |
|
|
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Mar 26, 2007 6:49 pm Post subject: |
|
|
thanks a lot guys,
i didn't test it yet. later if i come back i will do and report. i'm very snoopy but haven't time at the moment.
attreus
|
|
Back to top |
|
|
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Mar 26, 2007 7:11 pm Post subject: |
|
|
@dragonshere
maybe i'm blind or to stupid i cant' find the changes in utils.dsc or do i have to download it from somewhere else?
attreus
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 26, 2007 7:36 pm Post subject: |
|
|
attreus,
I have added an @Table(Get,CheckBox) function which will return the current checkbox state. Please download the latest version of utils.dsc file above.
Aslan,
The utils.dsc file already does all the hard stuff for you. You only need to include it in your script and use the commands and functions to get check boxes for the Table element.
To each his own I guess.
Code: |
#-----------------------------------------------------------------------------#
# #
# Default script template - to change it edit <vdspath>\default.dsc #
# #
# Author: Johnny Kinsey #
# #
# Copyright: Copyright © 2007 DragonSphere Software #
# #
#-----------------------------------------------------------------------------#
#INCLUDE utils.dsc
DIALOG CREATE,New Dialog,-1,0,317,160
REM *** Modified by Dialog Designer on 3/26/2007 - 15:01 ***
DIALOG ADD,TABLE,TABLE1,10,31,256,108,Column 1[80]|Column 2[80]|Column 3[80],,CLICK
DIALOG ADD,STATUS,STATUS1
DIALOG SHOW
# Give the Table grid lines, full row select, info tips, and check boxes
Table Set,ExtStyle,TABLE1,GRIDLINES|FULLROWSELECT|INFOTIP|CHECKBOXES
# Add some items to the table
List Add,TABLE1,row1@tab()This is some real long text to test the infotip@tab()row1
List Add,TABLE1,row2@tab()row2@tab()This is some real long text to test the infotip
List Add,TABLE1,This is some real long text to test the infotip@tab()row3@tab()row3
List Create,1
List LoadFile,1,checkstates.dat
If @Greater(@count(1),0)
%%cnt = 0
Repeat
%%State = @Item(1,%%cnt)
If @Equal(%%State,1)
Table Set,CheckBox,TABLE1,%%cnt,1
End
%%cnt = @succ(%%cnt)
Until @Equal(%%cnt,@count(1))
while @event()
wend
Else
# Seek to the first item and by the way this will set the checkbox for item 0
List Seek,TABLE1,0
End
:evloop
Repeat
WAIT EVENT,0.5
%E = @EVENT()
If %E
GoSub %E
End
Until @Equal(%E,CLOSE)
Exit
:CLOSE
List clear,1
%%CNT = 0
Repeat
If @Table(Get,CheckBox,TABLE1,%%cnt)
List Add,1,1
Else
List Add,1,0
End
%%cnt = @succ(%%cnt)
Until @Equal(%%cnt,@count(TABLE1))
List SaveFile,1,checkstates.dat
List clear,1
List close,1
Exit
:TIMER
# Get the checkbox state of the last item clicked
If @Table(Get,CheckBox,TABLE1,%%Index)
# If checked set the status windows text
Dialog Set,Status1,%%Index has been checked
Else
# if it is not checked clear the status bar
Dialog Set,Status1,
End
Exit
:TABLE1CLICK
# Get the current index of the table
%%Index = @Index(TABLE1)
# Togle based on current checkbox state
If @Table(Get,CheckBox,TABLE1,%%Index)
#Uncheck if the item is checked
Table Set,CheckBox,TABLE1,%%Index,0
Else
#Check the item if it is unchecked
Table Set,CheckBox,TABLE1,%%Index,1
End
while %E
# This is here to clear the extra click event from changing the Checkbox State
%E = @event()
wend
Exit
|
_________________ Home of
Give VDS a new purpose!
Last edited by vdsalchemist on Mon Mar 26, 2007 8:53 pm; edited 4 times in total |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 26, 2007 7:39 pm Post subject: |
|
|
attreus wrote: | @dragonshere
maybe i'm blind or to stupid i cant' find the changes in utils.dsc or do i have to download it from somewhere else?
attreus |
Nope your neither blind or stupid... It is me that is blind and stupid... I uploaded the wrong copy I just fixed it so now you should be able to download the correct version.
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Mar 26, 2007 7:56 pm Post subject: |
|
|
Yeah thats's it. you are great dragonsphere!
thanks a lot.
i was not able to create the LVITEM-Structure.
it works perfect but to add the checkboxes using your table set command i
don't know the fourth parameter. do you have an exaple-script how to use this great extension?
attreus
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 26, 2007 8:13 pm Post subject: |
|
|
attreus wrote: | Yeah thats's it. you are great dragonsphere!
thanks a lot.
i was not able to create the LVITEM-Structure.
it works perfect but to add the checkboxes using your table set command i
don't know the fourth parameter. do you have an exaple-script how to use this great extension?
attreus |
I posted an example of how to use this about 4 posts back in this thread...
Code: |
# Gives the Table Grid Lines, full row select, info tip, and checkboxes
Table Set,ExtStyle,TABLE1,GRIDLINES|FULLROWSELECT|INFOTIP|CHECKBOXES
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
attreus Valued Newbie
Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Mon Mar 26, 2007 8:19 pm Post subject: |
|
|
ok, thanks again.
i was wondering about the expected @fsep().
attreus
ps: how do i mark this thread "solved"?
|
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Mon Mar 26, 2007 8:24 pm Post subject: |
|
|
Nice little DSU Dragonshere,
Two questions,
1) How would you save the item states when exiting the app?
I used the hidden column to save the item states so that when the Table is saved, the states are saved with it.
2) I noticed you had some color options in your DSU. Is there a way to have different colors for each row? I know this can be done with GadgetX. I was just wondering if it can be done with VDS and API.
|
|
Back to top |
|
|
|
|
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
|
|