Page 1 of 1

Setting check list box values as "checked" by default

Posted: Mon Mar 07, 2011 6:50 am
by chakresh
Hi,

I am setting the items in the check list box dynamically at run time.

My requirement is to set the value of these items as "checked" by default.How I can do this , I am unable to find any property which can be modified to set the values as "checked" by default.

Please help if anyone has any idea.

Thanks . :)

Re: Setting check list box values as "checked" by default

Posted: Mon Mar 07, 2011 9:26 am
by giaviv
Dear chakresh,

You will need to check the actual button that you want checked by default and set it's variable to TRUE in the script.

Re: Setting check list box values as "checked" by default

Posted: Tue Mar 08, 2011 10:18 am
by chakresh
Hi Giaviv,

Thanks for the reply , can you elaborate little more that how I need to proceed on this, step by step and what exactly I need to change in the script ( "set it's variable to TRUE in the script" )

Let me explain what exactly I am trying to do .I am creating a string separated by new line characters and then setting it into the checklistbox control using a variable, this list at run time becomes the items of the checklistbox control.

Now these item are unchecked , and user wants them to be checked by default.

Thanks :)

Re: Setting check list box values as "checked" by default

Posted: Tue Mar 08, 2011 11:58 am
by giaviv
Dear chakresh,

Could you please attach here the script that you are using to populate the checklistbox?

Re: Setting check list box values as "checked" by default

Posted: Wed Mar 09, 2011 12:35 am
by chakresh
Hi, This is how my code looks like.

Comment: To get a comma separated list of DSN names and replace comma with newline char.
Read from Text File C:\DSNList.txt into Variable CHECKLISTBOXSTRING (get EOF into SUCCESS)
Replace , with $NEWLINE$ in variable CHECKLISTBOXSTRING
Display Dialog: DisplayDSNList, wait for dialog to return (modal)

the above variable is set into the checklistbox control on the screen
this is how it looks in development environment
img1.JPG
img1.JPG (26.2 KiB) Viewed 11193 times
and this is how it looks at runtime
img2.JPG
img2.JPG (26.23 KiB) Viewed 11193 times

now user wants all the above items as checked by default.

Re: Setting check list box values as "checked" by default

Posted: Wed Mar 09, 2011 1:42 am
by giaviv
Dear chakresh,

Please send your project (or just the dialog and the script) to support at installaware.com. Thanks!

Re: Setting check list box values as "checked" by default

Posted: Wed Mar 09, 2011 8:02 am
by chakresh
Hi Aviv,

I have sent the source code at the email address given by you, please see and let me know if any input need from my side.
The source code contains the sample application in which I have implemented my functionality related to the checklistbox as discussed above.

Thanks in advance for taking out time for this, :)
Chakresh

Re: Setting check list box values as "checked" by default

Posted: Wed Mar 09, 2011 9:01 am
by chakresh
Hi Aviv,

The problem has been resolved, I was missing one simple trick :) , thanks for all your help.
The mistake was that I was assigning and returning value in different variables from the checklistbox .When I took same variables in assigned value and return value for items it shows checked by default.

thanks
chakresh

Re: Setting check list box values as "checked" by default

Posted: Wed Mar 09, 2011 9:10 am
by giaviv
Dear chakresh,

This is what you need to do before displaying the dialog:
Set Variable CHECKLISTSTRRET to DSN1$NEWLINE$DSN2$NEWLINE$DSN3$NEWLINE$DSN4

Or

~InstallAware Clipboard Data~
~Set Variable~
~{63FF2C7D-D22F-4AB3-8E18-4C254C9F2B17}~
~CHECKLISTSTRRET$MYAH$MYAH$FALSE~
~DSN1$NEWLINE$DSN2$NEWLINE$DSN3$NEWLINE$DSN4~

Re: Setting check list box values as "checked" by default

Posted: Wed Mar 09, 2011 10:03 pm
by chakresh
Yes, Thanks

Re: Setting check list box values as "checked" by default

Posted: Thu Mar 10, 2011 12:50 pm
by bokkie
Aviv,

Perhaps I'm just having a total blank but what was the objective of what this thread was meant to achieve? I sort of get the impression that it creates checkboxes dynamically at runtime? I've probably missed the point in reading it but it's a good solution...if only I could understand the problem it solves! :) Could you elaborate a little more for me?

Re: Setting check list box values as "checked" by default

Posted: Tue Mar 22, 2011 7:03 am
by chakresh
HI,

sorry for delayed reply. :)

Yes I was trying to create check boxes at run time and was trying to keep them as checked by default.Check list Box control was a good option for doing this , but with checklist box control we cant treat each individual check box separately. Hence properties like "checked" are not available in it , which is there in a normal check box.