Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating SysTreeView32 dialog
#1
Can you help to create a dialog with SysTreeView32, Button and Edit: to insert edit text to SysTreeView32 as son of selected item in SysTreeView32.
Finally convert SysTreeView32 to text.

Thanks in advance.
#2
I used XML format to save tree view control data.

FUNCTIONS:
dialog_treeview_xml
XmlToTreeView
XmlFromTreeView


Attached Files
.qml   XML and tree view control.qml (Size: 3.25 KB / Downloads: 224)
#3
Thank you very much.

Perfect to learn.
#4
How can I expand all items in WM_INITDIALOG

and

how can i get a string like:

a1
a2
....b1
....b2
..........c1
..........c2
....b3
a3

?

Thanks again.
#5
I would try to send TVM_EXPAND message recursively.

----------

Function StringFromTreeView
Code:
Copy      Help
;/
function str&s htv [htvi] [__indent]

;Gets tree view control items to tab-indented string.

;s - variable that receives string.
;htv - control handle.
;htvi - parent item handle. Can be 0.
;__indent - don't use.


if(!__indent) s.all
htvi=SendMessage(htv TVM_GETNEXTITEM iif(htvi TVGN_CHILD TVGN_ROOT) htvi)
rep
,if(!htvi) break
,TVITEMW t.mask=TVIF_TEXT|TVIF_CHILDREN
,t.hItem=htvi
,BSTR b; if(!b) b.alloc(1000)
,t.pszText=b; t.cchTextMax=1001
,SendMessage(htv TVM_GETITEMW 0 &t)
,_s.ansi(b)
,str si.all(__indent 2 9) ;;creates string of __indent tabs. Change to other characters if need.
,s.formata("%s%s[]" si _s)
,if t.cChildren
,,StringFromTreeView s htv htvi __indent+1
,htvi=SendMessage(htv TVM_GETNEXTITEM TVGN_NEXT htvi)

err+ end _error
#6
Is possible modify StringFromTreeView like http://www.planetsourcecode.com/vb/scri ... &lngWId=10?
#7
I would try to replace tabs to Unicode subrange "Box Drawings" characters │└├

Code:
Copy      Help
a1
├1
│└11
└2
#8
Member function str.ReplaceIndentTabsToTreeLines
Code:
Copy      Help
;EXAMPLE
;out
;str s
;StringFromTreeView s id(2202 _hwndqm)
;s.ReplaceIndentTabsToTreeLines
;out s


if(!_unicode) end "must be Unicode mode"

ARRAY(lpstr) a; int i j k; lpstr t
if(tok(this a -1 "[]")<2) ret

for i 0 a.len
,t=a[i]
,for j 0 1000000000
,,if(t[0]!9) break
,,if(t[1]=9)
,,,t[0]=1 ;;│
,,,;replace some extra │
,,,if i+1=a.len or (a[i+1][j]!9 and (i+2=a.len or a[i+1]+j<a[i+2]))
,,,,for(k i -1 -1) if(a[k][j]=1) a[k][j]=32; else a[k][j]=3; break
,,else if(i+1<a.len and a[i+1][j]=9 and (i+2=a.len or a[i+1]+j<a[i+2])) t[0]=2 ;;├
,,else t[0]=3 ;;└
,,t+1

;at first used  characters 1, 2, 3. Now replace to multibyte UTF-8 characters.
findreplace("[1]" "│")
findreplace("[2]" "├")
findreplace("[3]" "└")
#9
Thanks. now I trying to noUnicode:

a
|-- b
| |-- c
| |-- d
| | |-- e
| | `-- f
| `-- g
| `-- h
|-- i
`-- j
`-- k

like tree /A (dos command)
#10
findreplace("[1]" "| ")
findreplace("[2]" "|--")
findreplace("[3]" "`--")


Forum Jump:


Users browsing this thread: 1 Guest(s)