flat assembler
Message board for the users of flat assembler.
Index
> Windows > [solved] How to create tree view list? Goto page 1, 2 Next |
Author |
|
zvn 23 Oct 2024, 12:20
How to create a list like in the picture?
|
||||||||||
23 Oct 2024, 12:20 |
|
AsmGuru62 23 Oct 2024, 12:38
This control already present on Windows.
You need to use CreateWindow API with the class name of "SysTreeView32". https://learn.microsoft.com/en-us/windows/win32/controls/tree-view-control-reference |
|||
23 Oct 2024, 12:38 |
|
zvn 23 Oct 2024, 14:01
AsmGuru62 wrote: This control already present on Windows. Thanks for your help! |
|||
23 Oct 2024, 14:01 |
|
bitRAKE 23 Oct 2024, 14:05
I have a rather terse example in my controls usage examples. I realize the syntax is fairly advanced - using the features of fasm2; but I am happy to help with any understanding.
Edit: Just realized you are working in 32-bit -- perhaps it is not a good example, for you. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
23 Oct 2024, 14:05 |
|
edfed 23 Oct 2024, 21:27
this kind of treeview should be in fasmw.
really. and interactive because fasm is very fast and real. just a single band (with scrollbar) pointing to where the current file is and i will be very very happy. but of course, it should be platform independent. like, wind, linux... hem, not fasml? ok, then, fasmw shoul dbe ported to debian, and so on... https://www.youtube.com/watch?v=fThinVykn-U and be sure, '4' will never happen in this suite, never! |
|||
23 Oct 2024, 21:27 |
|
macomics 24 Oct 2024, 03:27
AsmGuru62 wrote: I have "Go To Definition" feature and I can search for occurences of an item in all files or in an active file. |
|||
24 Oct 2024, 03:27 |
|
Picnic 24 Oct 2024, 11:50
AsmGuru62 wrote: The tree in FASM IDE would be great! Yes i think it would be nice. Personally, I can't work without such a feature (tree), and at the same time with several open windows and split editor view. That's why I've been using Notepad++ consistently for many years for my simple programming needs in ASM/C/BASIC. Sorry for being off topic, zvn. |
|||
24 Oct 2024, 11:50 |
|
zvn 05 Nov 2024, 06:39
Quote: Sorry for being off topic, zvn. Glad to serve you) When I tried to add a tree-view control to the form, I found that in the "comctl32.inc" file, in the "Common control window classes" section, some class names differ from those used in the Microsoft manuals, for example, the tree-view element is called "TREEVIEW_CLASS", while in the manuals it is "WC_TREEVIEW". Who is important, what is the reason for changing the class names? |
|||
05 Nov 2024, 06:39 |
|
zvn 05 Nov 2024, 06:58
Help me understand why adding an element to the tree-view in the code below does not work. I am sure that the error is in filling the TV_ITEM structure, since the elements are added, but for some reason they are empty.
Code: format PE GUI include 'win32w.inc' entry beg section '.code' code executable beg: invoke GetModuleHandle, 0 invoke DialogBoxParam, eax, 0, HWND_DESKTOP, DialogProc, 0 invoke ExitProcess, 0 proc DialogProc hwnddlg, msg, wParam, lParam xor eax, eax cmp [msg], WM_CLOSE je FreeDialog cmp [msg], WM_COMMAND jne ExitProc mov eax, BN_CLICKED shl eax, 16 add eax, 10 cmp eax, [wParam] mov [tvi.mask], TVIF_TEXT mov [tvi.hItem], 0 mov [tvi.state], 0 mov [tvi.stateMask], 0 mov [tvi.pszText], _testTree mov [tvi.cchTextMax], 6 mov [tvi.iImage], 0 mov [tvi.iSelectedImage], 0 mov [tvi.cChildren], 0 mov [tvi.lParam], 0 mov [tvins.hParent], TVI_ROOT mov [tvins.hInsertAfter], TVI_FIRST mov [tvins.item], dword tvi invoke SendDlgItemMessage, [hwnddlg], 1, TVM_INSERTITEM, 0, tvins ret FreeDialog: invoke EndDialog, [hwnddlg], 0 ExitProc: xor eax, eax ret endp section '.data' data readable writeable tvi TV_ITEM tvins TV_INSERTSTRUCT _testTree du 'abc',0 section 'import' import readable library kernel, 'kernel32.dll',\ user, 'user32.dll' import kernel,\ GetModuleHandle, 'GetModuleHandleW',\ ExitProcess, 'ExitProcess' import user,\ DialogBoxParam, 'DialogBoxParamW',\ EndDialog, 'EndDialog',\ SetDlgItemText, 'SetDlgItemTextW',\ SendDlgItemMessage, 'SendDlgItemMessageW',\ MessageBox, 'MessageBoxW',\ LoadMenu, 'LoadMenuW',\ SetMenu, 'SetMenu',\ GetDlgItem, 'GetDlgItem' section '.rsrc' resource readable directory RT_DIALOG, dialogs resource dialogs, 0, LANG_NEUTRAL, MainWindow dialog MainWindow, 'MainDLG', 700, 300, 100, 100, WS_VISIBLE+WS_CAPTION+WS_SYSMENU dialogitem WC_TREEVIEW, '', 1, 10, 10, 50, 50, WS_VISIBLE+WS_BORDER dialogitem 'button', 'add', 2, 10, 70, 20, 20, WS_VISIBLE enddialog Oh yeah, if you run this code, don't forget to change the class name in the resources: WC_TREEVIEW to TREEVIEW_CLASS! |
|||
05 Nov 2024, 06:58 |
|
macomics 05 Nov 2024, 09:48
zvn wrote: When I tried to add a tree-view control to the form, I found that in the "comctl32.inc" file, in the "Common control window classes" section, some class names differ from those used in the Microsoft manuals, for example, the tree-view element is called "TREEVIEW_CLASS", while in the manuals it is "WC_TREEVIEW". ADD: Code: format PE GUI include 'win32w.inc' entry beg section '.code' code executable beg: invoke GetModuleHandle, 0 invoke DialogBoxParam, eax, 0, HWND_DESKTOP, DialogProc, 0 invoke ExitProcess, 0 proc DialogProc hwnddlg, msg, wParam, lParam xor eax, eax cmp [msg], WM_CLOSE je FreeDialog cmp [msg], WM_COMMAND jne ExitProc mov eax, BN_CLICKED shl eax, 16 add eax, 10 cmp eax, [wParam] mov [tvins.hParent], TVI_ROOT mov [tvins.hInsertAfter], TVI_FIRST mov [tvins.item.mask], TVIF_TEXT mov [tvins.item.hItem], 0 mov [tvins.item.state], 0 mov [tvins.item.stateMask], 0 mov [tvins.item.pszText], _testTree mov [tvins.item.cchTextMax], 6 mov [tvins.item.iImage], 0 mov [tvins.item.iSelectedImage], 0 mov [tvins.item.cChildren], 0 mov [tvins.item.lParam], 0 invoke SendDlgItemMessage, [hwnddlg], 1, TVM_INSERTITEM, 0, tvins ret FreeDialog: invoke EndDialog, [hwnddlg], 0 ExitProc: xor eax, eax ret endp section '.data' data readable writeable tvi TV_ITEM tvins TV_INSERTSTRUCT _testTree db 'abc',0 section 'import' import readable library kernel, 'kernel32.dll',\ user, 'user32.dll' import kernel,\ GetModuleHandle, 'GetModuleHandleW',\ ExitProcess, 'ExitProcess' import user,\ DialogBoxParam, 'DialogBoxParamW',\ EndDialog, 'EndDialog',\ SetDlgItemText, 'SetDlgItemTextW',\ SendDlgItemMessage, 'SendDlgItemMessageW',\ MessageBox, 'MessageBoxW',\ LoadMenu, 'LoadMenuW',\ SetMenu, 'SetMenu',\ GetDlgItem, 'GetDlgItem' section '.rsrc' resource readable directory RT_DIALOG, dialogs resource dialogs, 0, LANG_NEUTRAL, MainWindow dialog MainWindow, 'MainDLG', 700, 300, 100, 100, WS_VISIBLE+WS_CAPTION+WS_SYSMENU dialogitem WC_TREEVIEW, '', 1, 10, 10, 50, 50, WS_VISIBLE+WS_BORDER dialogitem 'button', 'add', 2, 10, 70, 20, 20, WS_VISIBLE enddialog |
|||
05 Nov 2024, 09:48 |
|
Hrstka 05 Nov 2024, 11:09
You can set cchTextMax to 0, the parameter will be ignored. For Unicode characters you must use TVM_INSERTITEMW instead of TVM_INSERTITEM
|
|||
05 Nov 2024, 11:09 |
|
zvn 05 Nov 2024, 11:32
macomics, Thank you, the issue has been resolved.
Hrstka wrote: You can set cchTextMax to 0, the parameter will be ignored. For Unicode characters you must use TVM_INSERTITEMW instead of TVM_INSERTITEM |
|||
05 Nov 2024, 11:32 |
|
Roman 06 Nov 2024, 09:21
fasmw 1.73 error: undefined WC_TREEVIEW
dialogitem WC_TREEVIEW, '', 1, 10, 10, 50, 50, WS_VISIBLE+WS_BORDER What is value for WC_TREEVIEW ? I found: WC_TREEVIEW equ "SysTreeView32" nice variant: Code: WC_TREEVIEW equ "SysTreeView32" dialogitem WC_TREEVIEW,'',1,10,10,50,50, WS_VISIBLE+WS_BORDER+TVS_LINESATROOT+TVS_HASLINES |
|||
06 Nov 2024, 09:21 |
|
zvn 06 Nov 2024, 16:28
Roman wrote: fasmw 1.73 error: undefined WC_TREEVIEW To get rid of the error, you must either change TREEVIEW_CLASS to WC_TREEVIEW in the "comctl32.inc" file, or use TREEVIEW_CLASS in the resources, or a pointer to the string "SysTreeView32" |
|||
06 Nov 2024, 16:28 |
|
AsmGuru62 06 Nov 2024, 19:23
I do this for the tree:
Code: TreeCtrlClass du "SysTreeView32",0 |
|||
06 Nov 2024, 19:23 |
|
Roman 08 Nov 2024, 12:15
Good variant.
Code: format PE GUI include 'c:\fasmw17316\include\Win32w.inc' entry beg section '.code' code executable beg: invoke GetModuleHandle, 0 invoke DialogBoxParam, eax, 0, HWND_DESKTOP, DialogProc, 0 invoke ExitProcess, 0 proc DialogProc hwnddlg, msg, wParam, lParam xor eax, eax cmp [msg], WM_CLOSE je FreeDialog cmp [msg], WM_COMMAND jne ExitProc mov eax, BN_CLICKED shl eax, 16 add eax, 2 ;this is IDE button cmp eax, [wParam] jnz ExitProc mov [tvins.hParent], 0;TVI_ROOT or 0 mov [tvins.hInsertAfter], TVI_ROOT ;TVI_FIRST mov [tvins.item.mask], TVIF_TEXT;+TVIF_CHILDREN mov [tvins.item.hItem], 0 mov [tvins.item.state], 0 mov [tvins.item.stateMask], 0 mov [tvins.item.pszText], _testTree mov [tvins.item.cchTextMax], 12 ;number symbols from text mov [tvins.item.iImage], 0 mov [tvins.item.iSelectedImage], 0 mov [tvins.item.cChildren], 0 mov [tvins.item.lParam], 0 invoke SendDlgItemMessage, [hwnddlg], 1, TVM_INSERTITEM, 0, tvins mov [tvins.hParent],eax ;this is needed! mov [tvins.hInsertAfter],TVI_LAST mov [tvins.item.pszText],tv1Txt2 invoke SendDlgItemMessage, [hwnddlg], 1, TVM_INSERTITEM, 0, tvins invoke SendDlgItemMessage, [hwnddlg], 1, TVM_INSERTITEM, 0, tvins inc byte [_testTree+5] ret FreeDialog: invoke EndDialog, [hwnddlg], 0 ExitProc: xor eax, eax ret endp section '.data' data readable writeable tvi TV_ITEM tvins TV_INSERTSTRUCT _testTree db 'abc000',0 tv1Txt2 db 'childrn',0 section 'import' import readable library kernel, 'kernel32.dll',\ user, 'user32.dll' import kernel,\ GetModuleHandle, 'GetModuleHandleW',\ ExitProcess, 'ExitProcess' import user,\ DialogBoxParam, 'DialogBoxParamW',\ EndDialog, 'EndDialog',\ SetDlgItemText, 'SetDlgItemTextW',\ SendDlgItemMessage, 'SendDlgItemMessageW',\ MessageBox, 'MessageBoxW',\ LoadMenu, 'LoadMenuW',\ SetMenu, 'SetMenu',\ GetDlgItem, 'GetDlgItem' section '.rsrc' resource readable WC_TREEVIEW equ "SysTreeView32" directory RT_DIALOG, dialogs resource dialogs, 0, LANG_NEUTRAL, MainWindow dialog MainWindow, 'MainDLG', 700, 300, 200, 200, WS_VISIBLE+WS_CAPTION+WS_SYSMENU dialogitem WC_TREEVIEW, '', 1, 10, 10, 80*2, 50*2, WS_VISIBLE+WS_BORDER+TVS_LINESATROOT+TVS_HASLINES+TVS_SHOWSELALWAYS+TVS_EDITLABELS+TVS_HASBUTTONS dialogitem 'button', 'add', 2, 10, 70*2, 20, 20, WS_VISIBLE enddialog
|
||||||||||
08 Nov 2024, 12:15 |
|
Roman 11 Nov 2024, 14:11
I try get text from treeview But not get any text.
tv TV_ITEM mov [tv.pszText],mybuffer mov [tv.cchTextMax],20 And do SendMessage |
|||
11 Nov 2024, 14:11 |
|
Roman 11 Nov 2024, 15:27
I done this !
Code: tvi TV_ITEM mov [tvi.mask],TVIF_TEXT mov [tvi.cchTextMax], 50 ;maximum name size bytes mov [tvi.pszText],textBuffer invoke GetDlgItem,[hwnddlg],1 push eax invoke SendMessage,eax,TVM_GETNEXTITEM,TVGN_FIRSTVISIBLE, 0 mov [tvi.hItem],eax pop eax invoke SendMessage,eax,TVM_GETITEMA, 0, tvi invoke MessageBox,0,textBuffer,0,0 We need do loop(for all names) and do TVM_GETNEXTITEM & TVGN_NEXTVISIBLE to jump next name. Then we get all names from treeView |
|||
11 Nov 2024, 15:27 |
|
zvn 12 Nov 2024, 14:18
Hello friends!
I am writing a MW_NOTIFY message handler for the TVN_SELCHANGED notification of the Tree-view control in the dialog window procedure. I encountered a problem getting the value of the hdr.code parameter of the NM_TREEVIEW structure. The description states that the TVN_SELCHANGED notification passes the address of the NM_TREEVIEW structure in the lParam parameter, which includes the MHDR structure. In fact, the lParam parameter contains the stack address, which in turn points to another address, using which with an offset of 8 (equal to the value of NM_TREEVIEW.hdr.code) I get an access violation error. How can I access a member of the structure whose address is passed in the lParam parameter? Maybe someone has encountered this problem? Maybe there is some solution? |
|||
12 Nov 2024, 14:18 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.