Posts: 153
Threads: 33
Joined: Aug 2009
Hi Gintaras
Im adding the Listitems of my YahooMessanger to the SysTreeView32 Control of my Dialog ( + Checkbox for each item)
Function
Dialog5
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("Dialog5" &Dialog5 0)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 184 "Dialog"
;3 SysTreeView32 0x54030000 0x0 2 2 164 178 ""
;4 Button 0x54032000 0x0 172 6 48 14 "Refresh"
;5 Button 0x54032000 0x0 172 30 48 16 "Save"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,TvAddItems id(3 hDlg)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4 TvAddItems id(3 hDlg)
,case 5
,case IDOK
,case IDCANCEL
ret 1
Function
TvAddItems
;/
function htv
SetWinStyle htv TVS_CHECKBOXES 1
SendMessage htv TVM_DELETEITEM 0 0
int i
Acc a=acc("" "LISTITEM" win("Yahoo! Messenger" "YahooBuddyMain") "SysListView32" "" 0x1)
if(a.a)
,i=a.a.ChildCount
,for a.elem 1 i
,,_s=a.Name
,,TvAdd htv 0 _s
Could you please help me to make a function that will get the checked items and save their names in a notepad?
Thank you
Posts: 12,086
Threads: 142
Joined: Dec 2002
This is with accessible objects. Normally should be used treeview control messages, but maybe with acc easier.
Function
TvGetCheckedItems
;/
function htv
Acc a=acc("" "CHECKBUTTON" htv)
if(!a.a) ret
rep
,if a.State&STATE_SYSTEM_CHECKED
,,_s=a.Name
,,out _s
,a.Navigate("next"); err break
Posts: 153
Threads: 33
Joined: Aug 2009
Posts: 153
Threads: 33
Joined: Aug 2009
Hi Gintaras
On a similar dialog i would like to have a "check all" box.
The only way i was able to work out..
Function
TvCheckAll
;/
function htv
Acc a=acc("" "CHECKBUTTON" htv)
if(!a.a) ret
act htv
rep
,if(a.State&STATE_SYSTEM_CHECKED=0)
,,a.Select(2)
,,key (VK_SPACE)
,a.Navigate("next"); err break
I dont know if the use of the key comand could cause problems if there are many items!? This is probably not the right way to do it but it works so far.
I wanted to ask if you could add flags to it?
like flag 0 (default) to uncheck all and flag 1 to check all.
I think flags are the right solution instead of having 1 function to check all items and 1 function to uncheck them...
Thank you for all you do even for "Hobby Coder" like me.
Posts: 153
Threads: 33
Joined: Aug 2009
Hi Gintaras
On a similar dialog i would like to have a "check all" box.
The only way i was able to work out..
Function
TvCheckAll
;/
function htv
Acc a=acc("" "CHECKBUTTON" htv)
if(!a.a) ret
act htv
rep
,if(a.State&STATE_SYSTEM_CHECKED=0)
,,a.Select(2)
,,key (VK_SPACE)
,a.Navigate("next"); err break
I dont know if the use of the key comand could cause problems if there are many items!? This is probably not the right way to do it but it works so far.
I wanted to ask if you could add flags to it?
like flag 0 (default) to uncheck all and flag 1 to check all.
I think flags are the right solution instead of having 1 function to check all items and 1 function to uncheck them...
Thank you for all you do even for "Hobby Coder" like me.
Posts: 12,086
Threads: 142
Joined: Dec 2002
Do you really need tree view? If it is simple list (without branches), simpler would be listbox, listview or QM grid. Listview and grid also support checkboxes and icons, and will look like treeview.
Posts: 153
Threads: 33
Joined: Aug 2009
No it doesnt have to be tree view. I saw this dialog in ur Archive file and found it usefull and not too hard to understand how to add data to the control. and to have a checkbox next to each item makes selecting user friendly.
Now i decided to try listview and was expecting we have something like LvAdd. I looked up the Archive file to see if there's some simple example but the dialogs that have a listview are too complex (colors,columns etc.) and too hard to read/understand for me.
Basically all i need is a simple list where i can add data like above (TvAddItems) and checkboxes next to the items that can be checked/unchecked from an other function.
may i ask why you used a tree view instead of list view on the dialog "treeview with checkboxes" in archive?
best regards
Posts: 153
Threads: 33
Joined: Aug 2009
how embarrassing..
Summing Column In QM Grid
sorry didnt see that before
Posts: 12,086
Threads: 142
Joined: Dec 2002
Easier with grid control. Look in Dialog Editor. Also can set properties there. Several sample functions available somewhere in System folder. You can use a DlgGrid variable and its function RowCheck. Set/get data using a dialog variable, in CSV format.
Quote:may i ask why you used a tree view instead of list view on the dialog "treeview with checkboxes" in archive?
Probably somebody asked it, don't remember.
Posts: 153
Threads: 33
Joined: Aug 2009
Will do. thanks for the tip!