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 


List all directories in Local Disk (C:) next to check boxes

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
gfunk999
Newbie


Joined: 24 May 2006
Posts: 10
Location: USA

PostPosted: Mon Jan 08, 2007 12:21 am    Post subject: List all directories in Local Disk (C:) next to check boxes Reply with quote

Hi all long time no see... Rolling Eyes

Please help, i'm trying to create a dialog that will list all directories on the C: drive and have check boxes next to each directory.
I've created this jpg in mspaint as an example of what i'm looking for ->

After the boxes are selected I want to use filecopy to copy the directories to E:\data drive.

Here's what I put togehter thanks to some examples from this forum...

Code:
  DIALOG CREATE,Test File Selection,-1,0,300,200,COLOR WHITE,SMALLCAP,CLASS TestFile
  DIALOG ADD,STYLE,STYLE2,Verdana,8,,,BLUE
  DIALOG ADD,STYLE,STYLE1,Verdana,8,,,
  DIALOG ADD,LIST,LIST1,8,8,280,136,Double Click to Remove entries,DBLCLICK
  DIALOG ADD,BUTTON,Directories,160,24,80,24,Directories,,STYLE1
  LIST CREATE, 1
  LIST CREATE, 2
  DIALOG ADD,BUTTON,Data_Transfer,160,160,112,24,Data Transfer
  DIALOG SHOW
 
  :timer
  :Evloop
  DIALOG CURSOR
  wait event,0
  goto @event()

 
  :DirectoriesBUTTON
  LIST CLEAR, 1
  %%File = @dirdlg(Directories,Directory Selection,)
  LIST APPEND, 1, %%file

  end
  :append
  LIST APPEND, 2,1
  LIST APPEND, LIST1, 1
  goto evloop
 
  :LIST1DBLCLICK
  LIST DELETE, LIST1
  goto evloop
 
  :Data_transferBUTTON
  File copy, %%File, E:\data,
  :Close
  exit
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Mon Jan 08, 2007 7:31 am    Post subject: Reply with quote

Not sure if there's a dll or dsu to do what you want.

But the way I'd do it is to get rid of the folder icons. Then I'd use checkbox icons instead. If a table item is clicked I'd change the 'unchecked icon' to a 'checked icon' (and add a value to a hidden field). If the item that's clicked on already has this value in the hidden field I'd replace the 'checked icon' with the 'unchecked icon' and delete the value in the hidden field. Then when it's time to copy the selected directories I'd loop through the list and only copy those items with the hidden value set.

_________________
cheers

Dave
Back to top
View user's profile Send private message
gfunk999
Newbie


Joined: 24 May 2006
Posts: 10
Location: USA

PostPosted: Mon Jan 08, 2007 9:55 am    Post subject: Reply with quote

Thanks for the quick reply DaveŽ

I'm ok not using the folder icons and doing it your way. However, I'm not sure how I can put the checkboxes next to my directory list. For example... If I use list loadfile, list1, c:\directories.txt (directories.txt contains a list of the c:\directories) to populate the dialog list1, how do I connect the checkboxes to this list? If possible could you please post a sample code or hint on how to.

Trimmed code
Code:
  DIALOG CREATE,New Dialog,-1,0,240,160
  DIALOG ADD,LIST,LIST1,8,40,176,144
  list create, 1
  DIALOG SHOW
  goto load
 
  :timer
  wait event
  goto @event()
 
  :load
  list loadfile, list1, c:\directories.txt
  goto timer

  :close
  exit


Thanks again,

Gary



directories.txt
 Description:

Download
 Filename:  directories.txt
 Filesize:  113 Bytes
 Downloaded:  1253 Time(s)

Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Mon Jan 08, 2007 11:39 am    Post subject: Reply with quote

Here's some example code:

Code:
  DIALOG CREATE,New Dialog,-1,0,304,217
  DIALOG ADD,TABLE,TABLE1,8,8,288,201,Directory[260]|Checked[0],,DBLCLICK,SORTED
  list create, 1
  DIALOG SHOW
  goto load
 
:timer
  wait event
  goto @event()
 
:load
  list loadfile, 1, c:\directories.txt
  if @greater(@count(1),0)
    repeat
      if @item(1)
        option fieldsep,|
        list add,table1,@item(1)@tab()@tab()|unchecked.bmp
      end
      %x = @next(1)
    until @not(@ok())
  end
  goto timer

:close
  exit

:table1dblclick
  %x = @item(table1)
  list delete,table1,@item(table1)
  option fieldsep,@tab()
  parse "%a;%b",%x
  option fieldsep,|
  if @equal(%b,X)
    list add,table1,%a@tab()@tab()|unchecked.bmp
  else
    list add,table1,%a@tab()X@tab()|checked.bmp
  end
  rem You can use 'dialog focus,controlname' here to move the cursor focus away from the list.
  goto timer

You'll need two 16x16 bmps - one named unchecked.bmp and the other named checked.bmp.

I used dblclick instead of click, as click events are generated by the script itself. And you can use an api sendmsg to hide the table header if you want the table to look like a bitlist.

PS I had to change your directorylist.txt file so each directory was on a separate line.

_________________
cheers

Dave
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Mon Jan 08, 2007 3:05 pm    Post subject: Reply with quote

Hi Smile

I am not safe of which it is wanted to do, but to place "checbox" in a table it is necessary to use the API of Windows.

See this reference in the forum:

http://forum.vdsworld.com/viewtopic.php?t=3796&highlight=table+style

Wink
______________
or visit uVeDeSe site:
http://www.uvedese.es


Last edited by uvedese on Wed Apr 02, 2008 8:40 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Tue Jan 09, 2007 8:57 am    Post subject: Reply with quote

But it is not really a checkbox he is suggesting you use, but a bitmap that looks like a checkbox.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
gfunk999
Newbie


Joined: 24 May 2006
Posts: 10
Location: USA

PostPosted: Tue Jan 09, 2007 8:59 am    Post subject: Reply with quote

Nice Dave! very nice... thank you so much, how much do I owe u? Laughing one thing though, I can't get my 16x16 .bmp's to work. You're piping the bmp's without using bitbtn, am I right?

DaveŽ wrote:
Here's some example code:

Code:
  DIALOG CREATE,New Dialog,-1,0,304,217
  DIALOG ADD,TABLE,TABLE1,8,8,288,201,Directory[260]|Checked[0],,DBLCLICK,SORTED
  list create, 1
  DIALOG SHOW
  goto load
 
:timer
  wait event
  goto @event()
 
:load
  list loadfile, 1, c:\directories.txt
  if @greater(@count(1),0)
    repeat
      if @item(1)
        option fieldsep,|
        list add,table1,@item(1)@tab()@tab()|unchecked.bmp
      end
      %x = @next(1)
    until @not(@ok())
  end
  goto timer

:close
  exit

:table1dblclick
  %x = @item(table1)
  list delete,table1,@item(table1)
  option fieldsep,@tab()
  parse "%a;%b",%x
  option fieldsep,|
  if @equal(%b,X)
    list add,table1,%a@tab()@tab()|unchecked.bmp
  else
    list add,table1,%a@tab()X@tab()|checked.bmp
  end
  rem You can use 'dialog focus,controlname' here to move the cursor focus away from the list.
  goto timer

You'll need two 16x16 bmps - one named unchecked.bmp and the other named checked.bmp.

I used dblclick instead of click, as click events are generated by the script itself. And you can use an api sendmsg to hide the table header if you want the table to look like a bitlist.

PS I had to change your directorylist.txt file so each directory was on a separate line.
Back to top
View user's profile Send private message
gfunk999
Newbie


Joined: 24 May 2006
Posts: 10
Location: USA

PostPosted: Tue Jan 09, 2007 9:05 am    Post subject: Reply with quote

Hi Jules and Uvedese nice to meet you...

Jules, thanks for pointing this out; do you think I can use an API as Uvedese suggested?

Gary

uvedese wrote:
Hi Smile

I am not safe of which it is wanted to do, but to place "checbox" in a table it is necessary to use the API of Windows.

See this reference in the forum:

http://forum.vdsworld.com/viewtopic.php?t=3796&highlight=table+style

Wink
______________
or visit uVeDeSe site:
http://es.geocities.com/uvedese
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Jan 09, 2007 12:16 pm    Post subject: Reply with quote

gfunk999 wrote:
Nice Dave! very nice... thank you so much, how much do I owe u?

Just help someone else in future when they ask a question you know the answer to. Cool

gfunk999 wrote:
one thing though, I can't get my 16x16 .bmp's to work.

I actually used 17x17 pixel bmps (screen grabs of actual checkboxes) even though the help file says they must be 16x16.
checkbox-bmps.zip They need to be in your project's main directory, or the include directory.

gfunk999 wrote:
You're piping the bmp's without using bitbtn, am I right?

Not really. The bitmap is a standard feature of tables (same as bitcombo and bitlists). You can use any field separator (except @tab()) and it must be the current field separator that your script is using. I just used the | pipe because it's the VDS default field separator.

You're actually clicking on the table item (not the checkbox) and the script is deleting the selected item and replacing it complete with the new bmp.

_________________
cheers

Dave
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Jan 09, 2007 12:40 pm    Post subject: Reply with quote

uvedese wrote:
I am not safe of which it is wanted to do, but to place "checbox" in a table it is necessary to use the API of Windows.

See this reference in the forum:

http://forum.vdsworld.com/viewtopic.php?t=3796&highlight=table+style

Very cool, uvedese. It's very handy for working out API messages for tables. But in this instance with adding checkboxes to a table how exactly do you determine if a table checkbox is checked or not in VDS? Obviously(?) you can't use @dlgtext()

I also downloaded and played with popmenu - also very cool. I have downloaded a bunch of your stuff before... but never got around to trying any of it. I just I wish I could read Spanish.

_________________
cheers

Dave
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Tue Jan 09, 2007 6:54 pm    Post subject: Reply with quote

Hi DaveŽ:

I am glad of which scripts is something useful... but, I also have many problems with the English... (many?... surely that my English is full of mistakes and errors) Confused

About checkboxes in table... it's possible is possible to see the state of each checkbox using API call...

FUNCTION "Get checkstate" (LVM_GETITEMSTATE)

It's necessary to read at the beginning the value that gives back the function:

Code:
%a = @sendmsg(@winexists(~TABLE1),@sum($1000,44),%%item,$F000)


where %%item is the "item" in table...

In one second reading the value will be greater if the checkbox is "check" (TRUE) Wink
________________
Back to top
View user's profile Send private message Visit poster's website
gfunk999
Newbie


Joined: 24 May 2006
Posts: 10
Location: USA

PostPosted: Wed Jan 10, 2007 8:58 am    Post subject: Reply with quote

Absolutely! Looking forward to help; Learning every day. Your 17x17 bmp's worked like a charm. I was initially putting my 16x16 bmp's inside the main project folder to no avail, thus I thought I had to use a path. Include and | separator make perfect sense.

Thanks again DaveŽ

DaveŽ wrote:
gfunk999 wrote:
Nice Dave! very nice... thank you so much, how much do I owe u?

Just help someone else in future when they ask a question you know the answer to. Cool

gfunk999 wrote:
one thing though, I can't get my 16x16 .bmp's to work.

I actually used 17x17 pixel bmps (screen grabs of actual checkboxes) even though the help file says they must be 16x16.
checkbox-bmps.zip They need to be in your project's main directory, or the include directory.

gfunk999 wrote:
You're piping the bmp's without using bitbtn, am I right?

Not really. The bitmap is a standard feature of tables (same as bitcombo and bitlists). You can use any field separator (except @tab()) and it must be the current field separator that your script is using. I just used the | pipe because it's the VDS default field separator.

You're actually clicking on the table item (not the checkbox) and the script is deleting the selected item and replacing it complete with the new bmp.
Back to top
View user's profile Send private message
gfunk999
Newbie


Joined: 24 May 2006
Posts: 10
Location: USA

PostPosted: Wed Jan 10, 2007 9:13 am    Post subject: Reply with quote

Uvedese,

Thanks for your link. I was like a kid in a candy store, going through half of your scripts was fun. Thanks to the PopMenu script, I learned that shinobisof has an informative site as well. I will definitely look into learning more about API. BTW, I think your English is fine. Smile

Gary

uvedese wrote:
Hi DaveŽ:

I am glad of which scripts is something useful... but, I also have many problems with the English... (many?... surely that my English is full of mistakes and errors) Confused

About checkboxes in table... it's possible is possible to see the state of each checkbox using API call...

FUNCTION "Get checkstate" (LVM_GETITEMSTATE)

It's necessary to read at the beginning the value that gives back the function:

Code:
%a = @sendmsg(@winexists(~TABLE1),@sum($1000,44),%%item,$F000)


where %%item is the "item" in table...

In one second reading the value will be greater if the checkbox is "check" (TRUE) Wink
________________
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 -> General Help 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