English
Forum

Treeview right Click

 

Jörg
Sellmeyer
Hi,

in this lovely Code Uwe Pascal Niemeyer becomes one Treeview created.

unfortunately succeed it I do not a Rechtsklick on one Item auszuwerten. The Focus hüpft always immediate back on
whom before chosen entry.
with one simulierten Click (thanks iF) remaining of course the Focus but first one Double click with right reads the Item from.
How can means with a einfachen Rechtsklick The Information read.
CompileMarkSeparation
 $H Windows.ph
 $H messages.ph
 $H CommCtrl.ph
window 50,50-600,400
usefont MS Sans Serif,15,7,0,0,0
setdialogfont 1
usermessages 16-------Fenster schließen abfangen
numwidth 6
strwidth 10
declare IcoList&,Tv&,Tv#
declare a&,b&,c&,d&
-----------------------------------------------------------------------------------ImageList
def ImageList_Create(5) !COMCTL32,ImageList_Create
def ImageList_AddIcon(2) !COMCTL32,ImageList_AddIcon
def ImageList_Destroy(1) !COMCTL32,ImageList_Destroy
def LoadIcon(2) !USER32,LoadIconA
IcoList&=ImageList_Create(16,16,1,1,0)---Parameter 1+2: Grösse der Icons
ImageList_AddIcon(IcoList&,LoadIcon(0,32512))---SystemIcons laden
ImageList_AddIcon(IcoList&,LoadIcon(0,32513))
ImageList_AddIcon(IcoList&,LoadIcon(0,32514))
ImageList_AddIcon(IcoList&,LoadIcon(0,32515))
----------------------------------------------------------------------------------Funktionen
def TvGetSelect(1) sendmessage(&(1),4362,9,0)-------TVM_GETNEXTITEM , TVIS_SELECTED
def TvInsertItem(1) sendmessage(&(1),4352,0,Tv#)----TVM_INSERTITEM
def TvGetItem(1) sendmessage(&(1),4364,0,Tv#+8)-----TVM_GETITEM
struct TV=Parent&,InsertAfter&,Mask&,Item&,State&,StateMask&,Text&,TextMax&,Ico1&,Ico2&,Children&,Data&,Text$(100)
dim Tv#,TV
clear Tv#
Tv#.Text&   = Tv#+48
Tv#.TextMax&= 100
Tv&=control(SysTreeView32,,$5000002f,0,0,0,0,%hwnd,200,%Hinstance,$200)
sendmessage(Tv&,4361,0,IcoList&)---TVM_SETIMAGELIST
Tv#.Mask&  =1+2+4+32---TVIF_IMAGE + TVIF_PARAM + TVIF_SELECTEDIMAGE + TVIF_TEXT
Tv#.Ico1&  =0
Tv#.Ico2&  =1
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$  =Eintrag 1
Tv#.Data& =1111
a&=TvInsertItem(Tv&)
Tv#.Parent&=a&---------unter Eintrag 1 einordnen
Tv#.Text$=Eintrag 2
Tv#.Data& =3333
b&=TvInsertItem(Tv&)
Tv#.Parent&=b&---------unter Eintrag 2 einordnen
Tv#.Text$=Eintrag 3
Tv#.Data& =4444
TvInsertItem(Tv&)
Tv#.Ico1&  =3
Tv#.Ico2&  =2
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$=Eintrag 4
Tv#.Data& =123
TvInsertItem(Tv&)
Tv#.Text$=Eintrag 5
Tv#.Data& =234
b&=TvInsertItem(Tv&)
Tv#.Text$=Eintrag 7
Tv#.Data& =345
TvInsertItem(Tv&)
Tv#.InsertAfter&=b&----------oberste Ebene, aber unterhalb von Eintrag 5
Tv#.Text$=Eintrag 6
Tv#.Data& =456
TvInsertItem(Tv&)
setwindowpos Tv&=250,10-300,300---Neuzeichnen wg. Baumstruktur

while 1

    waitinput
    case %umessage=16:break------------------Fenster schließen
    locate 0,0

    If GetFocus(TV&) AND (%childmessage = ~WM_LBUTTONDOWN)

        Tv#.Item&=TvGetSelect(Tv&)
        TvGetItem(Tv&)
        print Tv#.Parent& :,Tv#.Parent&
        print Tv#.Item& :,Tv#.Item&
        print Linksklick Tv#.Text$ :,Tv#.Text$
        print Tv#.Ico1& :,Tv#.Ico1&
        print Tv#.Ico2& :,Tv#.Ico2&
        print Tv#.Data& :,Tv#.Data&

    ElseIf GetFocus(TV&) AND (%childmessage = ~WM_RBUTTONDOWN)

        Mit MouseEvent bleibt zwar der Focus auf dem Item aber erst mit rechtem
        Doppelklick füllt sich die Struktur
        ~Mouse_Event(~MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
        ~Mouse_Event(~MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
        Tv#.Item&=TvGetSelect(Tv&)
        TvGetItem(Tv&)
        Print Rechtklick Tv#.Item$ :,Tv#.Text$

    EndIf

endwhile

destroywindow(Tv&)
case IcoList&:ImageList_Destroy(IcoList&=s2>)
dispose Tv#

Greeting
Jörg
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/06/06  
 



Probier time:
CompileMarkSeparation
 $H Windows.ph
 $H Messages.ph
 $H Commctrl.ph
Window 50,50-600,400
Usefont MS Sans Serif,15,7,0,0,0
Setdialogfont 1
Usermessages 16-------Fenster schließen abfangen
Numwidth 6
Strwidth 10
Declare Icolist&,Tv&,Tv#
Declare A&,B&,C&,D&
-----------------------------------------------------------------------------------ImageList
Def Imagelist_create(5) !COMCTL32,ImageList_Create
Def Imagelist_addicon(2) !COMCTL32,ImageList_AddIcon
Def Imagelist_destroy(1) !COMCTL32,ImageList_Destroy
Def Loadicon(2) !USER32,LoadIconA
Icolist&=Imagelist_create(16,16,1,1,0)---Parameter 1+2: Grösse der Icons
Imagelist_addicon(Icolist&,Loadicon(0,32512))---SystemIcons laden
Imagelist_addicon(Icolist&,Loadicon(0,32513))
Imagelist_addicon(Icolist&,Loadicon(0,32514))
Imagelist_addicon(Icolist&,Loadicon(0,32515))
----------------------------------------------------------------------------------Funktionen
Def Tvgetselect(1) Sendmessage(&(1),4362,9,0)-------TVM_GETNEXTITEM , TVIS_SELECTED
Def Tvinsertitem(1) Sendmessage(&(1),4352,0,Tv#)----TVM_INSERTITEM
Def Tvgetitem(1) Sendmessage(&(1),4364,0,Tv#+8)-----TVM_GETITEM
Struct Tv=Parent&,Insertafter&,Mask&,Item&,State&,Statemask&,Text&,Textmax&,Ico1&,Ico2&,Children&,Data&,Text$(100)
Dim Tv#,Tv
Clear Tv#
Tv#.Text& = Tv#+48
Tv#.Textmax&= 100
Tv&=Control(SysTreeView32,,$5000002F,0,0,0,0,%Hwnd,200,%Hinstance,$200)
Sendmessage(Tv&,4361,0,Icolist&)---TVM_SETIMAGELIST
Tv#.Mask& =1+2+4+32---TVIF_IMAGE + TVIF_PARAM + TVIF_SELECTEDIMAGE + TVIF_TEXT
Tv#.Ico1& =0
Tv#.Ico2& =1
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$ =Eintrag 1
Tv#.Data& =1111
A&=Tvinsertitem(Tv&)
Tv#.Parent&=A&---------unter Eintrag 1 einordnen
Tv#.Text$=Eintrag 2
Tv#.Data& =3333
B&=Tvinsertitem(Tv&)
Tv#.Parent&=B&---------unter Eintrag 2 einordnen
Tv#.Text$=Eintrag 3
Tv#.Data& =4444
Tvinsertitem(Tv&)
Tv#.Ico1& =3
Tv#.Ico2& =2
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$=Eintrag 4
Tv#.Data& =123
Tvinsertitem(Tv&)
Tv#.Text$=Eintrag 5
Tv#.Data& =234
B&=Tvinsertitem(Tv&)
Tv#.Text$=Eintrag 7
Tv#.Data& =345
Tvinsertitem(Tv&)
Tv#.Insertafter&=B&----------oberste Ebene, aber unterhalb von Eintrag 5
Tv#.Text$=Eintrag 6
Tv#.Data& =456
Tvinsertitem(Tv&)
Setwindowpos Tv&=250,10-300,300---Neuzeichnen wg. Baumstruktur

While 1

    Waitinput
    Case %Umessage=16:Break------------------Fenster schließen
    Locate 0,0

    If Getfocus(Tv&) And (%Childmessage = ~Wm_lbuttondown)

        Tv#.Item&=Tvgetselect(Tv&)
        Tvgetitem(Tv&)
        print Tv#.Parent& :,Tv#.Parent&
        print Tv#.Item& :,Tv#.Item&
        Print Linksklick Tv#.Text$ :,Tv#.Text$
        print Tv#.Ico1& :,Tv#.Ico1&
        print Tv#.Ico2& :,Tv#.Ico2&
        print Tv#.Data& :,Tv#.Data&

    Elseif Getfocus(Tv&) And (%Childmessage = ~Wm_rbuttondown)

        Mit MouseEvent bleibt zwar der Focus auf dem Item aber erst mit rechtem
        Doppelklick füllt sich die Struktur
        ~Mouse_event(~Mouseeventf_leftdown, 0, 0, 0, 0)
        ~Mouse_event(~Mouseeventf_leftup, 0, 0, 0, 0)
        dulcoiF
        Tv#.Item&=Tvgetselect(Tv&)
        Tvgetitem(Tv&)
        Print Rechtklick Tv#.Item$ :,Tv#.Text$

    Endif

Endwhile

Destroywindow(Tv&)
Case Icolist&:Imagelist_destroy(Icolist&)
Dispose Tv#

proc dulcoiF

    settimer 1;waitinput;killtimer

endproc

 
10/06/06  
 




Jörg
Sellmeyer
functions unfortunately neither
The Auswertung results well over NM_TREEVIEW. Then a NMHDR-structure filled and the says one then, whether with right clicked watts.
moreover becomes then but another TV_HITTESTINFO -structure and the Message TVM_HITTEST versendet.

unfortunately smoking me with this whole Structures with suitable Masken u.s.w. always the the head. so integrally look I there not yet through.

In one Power Basic-Forum have I time this code found:
CompileMarkSeparation
so How I the understand, simulate it too a Click with left but then even these HitTest-story...
I Have time yet ne Textdatei with More PB-code appended. there must I yet with difficulty durcharbeiten, I except Profan no Programmierkenntnisse have.
Perhaps can from it someone leichter what discern.

Greeting
Jörg

6 kB
Hochgeladen:10/06/06
Downloadcounter56
Download
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/06/06  
 



Hm by me functions my example under XPHome.
 
10/06/06  
 




Jörg
Sellmeyer
this is Yes n thing... by me functions it always first to the second Click with right (XP Professional)
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/06/06  
 



And so?
CompileMarkSeparation
 $H Windows.ph
 $H Messages.ph
 $H Commctrl.ph
Window 50,50-600,400
Usefont MS Sans Serif,15,7,0,0,0
Setdialogfont 1
Usermessages 16-------Fenster schließen abfangen
Numwidth 6
Strwidth 10
Declare Icolist&,Tv&,Tv#
Declare A&,B&,C&,D&
-----------------------------------------------------------------------------------ImageList
Def Imagelist_create(5) !COMCTL32,ImageList_Create
Def Imagelist_addicon(2) !COMCTL32,ImageList_AddIcon
Def Imagelist_destroy(1) !COMCTL32,ImageList_Destroy
Def Loadicon(2) !USER32,LoadIconA
Icolist&=Imagelist_create(16,16,1,1,0)---Parameter 1+2: Grösse der Icons
Imagelist_addicon(Icolist&,Loadicon(0,32512))---SystemIcons laden
Imagelist_addicon(Icolist&,Loadicon(0,32513))
Imagelist_addicon(Icolist&,Loadicon(0,32514))
Imagelist_addicon(Icolist&,Loadicon(0,32515))
----------------------------------------------------------------------------------Funktionen
Def Tvgetselect(1) Sendmessage(&(1),4362,9,0)-------TVM_GETNEXTITEM , TVIS_SELECTED
Def Tvinsertitem(1) Sendmessage(&(1),4352,0,Tv#)----TVM_INSERTITEM
Def Tvgetitem(1) Sendmessage(&(1),4364,0,Tv#+8)-----TVM_GETITEM
Struct Tv=Parent&,Insertafter&,Mask&,Item&,State&,Statemask&,Text&,Textmax&,Ico1&,Ico2&,Children&,Data&,Text$(100)
Dim Tv#,Tv
Clear Tv#
Tv#.Text& = Tv#+48
Tv#.Textmax&= 100
Tv&=Control(SysTreeView32,,$5000002F,0,0,0,0,%Hwnd,200,%Hinstance,$200)
Sendmessage(Tv&,4361,0,Icolist&)---TVM_SETIMAGELIST
Tv#.Mask& =1+2+4+32---TVIF_IMAGE + TVIF_PARAM + TVIF_SELECTEDIMAGE + TVIF_TEXT
Tv#.Ico1& =0
Tv#.Ico2& =1
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$ =Eintrag 1
Tv#.Data& =1111
A&=Tvinsertitem(Tv&)
Tv#.Parent&=A&---------unter Eintrag 1 einordnen
Tv#.Text$=Eintrag 2
Tv#.Data& =3333
B&=Tvinsertitem(Tv&)
Tv#.Parent&=B&---------unter Eintrag 2 einordnen
Tv#.Text$=Eintrag 3
Tv#.Data& =4444
Tvinsertitem(Tv&)
Tv#.Ico1& =3
Tv#.Ico2& =2
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$=Eintrag 4
Tv#.Data& =123
Tvinsertitem(Tv&)
Tv#.Text$=Eintrag 5
Tv#.Data& =234
B&=Tvinsertitem(Tv&)
Tv#.Text$=Eintrag 7
Tv#.Data& =345
Tvinsertitem(Tv&)
Tv#.Insertafter&=B&----------oberste Ebene, aber unterhalb von Eintrag 5
Tv#.Text$=Eintrag 6
Tv#.Data& =456
Tvinsertitem(Tv&)
Setwindowpos Tv&=250,10-300,300---Neuzeichnen wg. Baumstruktur

While 1

    Waitinput
    Case %Umessage=16:Break------------------Fenster schließen
    Locate 0,0

    If Getfocus(Tv&) And (%Childmessage = ~Wm_lbuttondown)

        Tv#.Item&=Tvgetselect(Tv&)
        Tvgetitem(Tv&)
        print Tv#.Parent& :,Tv#.Parent&
        print Tv#.Item& :,Tv#.Item&
        Print Linksklick Tv#.Text$ :,Tv#.Text$
        print Tv#.Ico1& :,Tv#.Ico1&
        print Tv#.Ico2& :,Tv#.Ico2&
        print Tv#.Data& :,Tv#.Data&

    endif

    if Getfocus(Tv&) And (%Childmessage = ~Wm_rbuttondown)

        Mit MouseEvent bleibt zwar der Focus auf dem Item aber erst mit rechtem
        Doppelklick füllt sich die Struktur
        ~Mouse_event(~Mouseeventf_leftdown, 0, 0, 0, 0)
        ~Mouse_event(~Mouseeventf_leftup, 0, 0, 0, 0)
        getmessage
        Tv#.Item&=Tvgetselect(Tv&)
        Tvgetitem(Tv&)
        Print Rechtklick Tv#.Item$ :,Tv#.Text$

    Endif

Endwhile

Destroywindow(Tv&)
Case Icolist&:Imagelist_destroy(Icolist&ass=s2>)
Dispose Tv#
 
10/06/06  
 



Nachtrag: Please as Prc or Exe testing.
 
10/06/06  
 




Jörg
Sellmeyer
functions too first ex the 2. Click - and then becomes the Editcontrol activate.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/06/06  
 



i think time, the corresponds to neither your imaginations, or?
CompileMarkSeparation
Def @GetCursorPos(1) !USER32,GetCursorPos
Def @ScreenToClient(2) !USER32,ScreenToClient
 $H Windows.ph
 $H Messages.ph
 $H Commctrl.ph
Window 50,50-600,400
Usefont MS Sans Serif,15,7,0,0,0
Setdialogfont 1
Usermessages 16-------Fenster schließen abfangen
Numwidth 6
Strwidth 10
Declare Icolist&,Tv&,Tv#
Declare A&,B&,C&,D&
-----------------------------------------------------------------------------------ImageList
Def Imagelist_create(5) !COMCTL32,ImageList_Create
Def Imagelist_addicon(2) !COMCTL32,ImageList_AddIcon
Def Imagelist_destroy(1) !COMCTL32,ImageList_Destroy
Def Loadicon(2) !USER32,LoadIconA
Icolist&=Imagelist_create(16,16,1,1,0)---Parameter 1+2: Grösse der Icons
Imagelist_addicon(Icolist&,Loadicon(0,32512))---SystemIcons laden
Imagelist_addicon(Icolist&,Loadicon(0,32513))
Imagelist_addicon(Icolist&,Loadicon(0,32514))
Imagelist_addicon(Icolist&,Loadicon(0,32515))
----------------------------------------------------------------------------------Funktionen
Def Tvgetselect(1) Sendmessage(&(1),4362,9,0)-------TVM_GETNEXTITEM , TVIS_SELECTED
Def Tvinsertitem(1) Sendmessage(&(1),4352,0,Tv#)----TVM_INSERTITEM
Def Tvgetitem(1) Sendmessage(&(1),4364,0,Tv#+8)-----TVM_GETITEM
Struct Tv=Parent&,Insertafter&,Mask&,Item&,State&,Statemask&,Text&,Textmax&,Ico1&,Ico2&,Children&,Data&,Text$(100)
Dim Tv#,Tv
Clear Tv#
Tv#.Text& = Tv#+48
Tv#.Textmax&= 100
Tv&=Control(SysTreeView32,,$5000002F,0,0,0,0,%Hwnd,200,%Hinstance,$200)
Sendmessage(Tv&,4361,0,Icolist&)---TVM_SETIMAGELIST
Tv#.Mask& =1+2+4+32---TVIF_IMAGE + TVIF_PARAM + TVIF_SELECTEDIMAGE + TVIF_TEXT
Tv#.Ico1& =0
Tv#.Ico2& =1
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$ =Eintrag 1
Tv#.Data& =1111
A&=Tvinsertitem(Tv&)
Tv#.Parent&=A&---------unter Eintrag 1 einordnen
Tv#.Text$=Eintrag 2
Tv#.Data& =3333
B&=Tvinsertitem(Tv&)
Tv#.Parent&=B&---------unter Eintrag 2 einordnen
Tv#.Text$=Eintrag 3
Tv#.Data& =4444
Tvinsertitem(Tv&)
Tv#.Ico1& =3
Tv#.Ico2& =2
Tv#.Parent&=0----------oberste Ebene
Tv#.Text$=Eintrag 4
Tv#.Data& =123
Tvinsertitem(Tv&)
Tv#.Text$=Eintrag 5
Tv#.Data& =234
B&=Tvinsertitem(Tv&)
Tv#.Text$=Eintrag 7
Tv#.Data& =345
Tvinsertitem(Tv&)
Tv#.Insertafter&=B&----------oberste Ebene, aber unterhalb von Eintrag 5
Tv#.Text$=Eintrag 6
Tv#.Data& =456
Tvinsertitem(Tv&)
Setwindowpos Tv&=250,10-300,300---Neuzeichnen wg. Baumstruktur

While 1

    Waitinput
    Case %Umessage=16:Break------------------Fenster schließen
    Locate 0,0

    If Getfocus(Tv&) And (%Childmessage = ~Wm_lbuttondown)

        Tv#.Item&=Tvgetselect(Tv&)
        Tvgetitem(Tv&)
        print Tv#.Parent& :,Tv#.Parent&
        print Tv#.Item& :,Tv#.Item&
        Print Linksklick Tv#.Text$ :,Tv#.Text$
        print Tv#.Ico1& :,Tv#.Ico1&
        print Tv#.Ico2& :,Tv#.Ico2&
        print Tv#.Data& :,Tv#.Data&

    Elseif Getfocus(Tv&) And (%Childmessage = ~Wm_rbuttondown)

        Mit MouseEvent bleibt zwar der Focus auf dem Item aber erst mit rechtem
        Doppelklick füllt sich die Struktur
        DIM H_TEST#,16
        Clear H_TEST#
        @GetCursorPos(H_TEST#)
        @ScreenToClient(TV&,H_TEST#)
        @Sendmessage(TV&,$1111,0,H_TEST#)
        @Sendmessage(TV&,$110B,$9,@long(H_TEST#,12))
        Dispose H_Test#
        Tv#.Item&=Tvgetselect(Tv&)
        Tvgetitem(Tv&)
        Print Rechtklick Tv#.Item$ :,Tv#.Text$

    Endif

Endwhile

Destroywindow(Tv&)
Case Icolist&:Imagelist_destroy(Icolis
n class=s2>) Dispose Tv#

having unfortunately no lauffähigen Text of you and wants hoping, the it works.

Greeting

Andreas
 
10/06/06  
 




Jörg
Sellmeyer
super Andreas! thanks, the has me very weitergeholfen. you have means The Screenkoordinaten the mouse via Hittest-Message on the TV sent.
the was very the, I sought have but How said: in structures understand I often only railway-station.

here again The meanings the Messages:

Sendmessage(Tv&,$1111,0,H_test#)~TVM_HitTest
Sendmessage(Tv&,$110B,$9,@Long(H_test#,12))~TVM_SELECTITEM

A. Hötker
having unfortunately no lauffähigen Text of you and wants hoping, the it works.


what means it so mere? What is because the, I mitgeschickt have? that the Code i'm, have I Yes none behauptet.
in the contrary: I Have whom Author Yes extra called!
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/06/06  
 




%Childmessage knows my Profan not
 
10/06/06  
 




Jörg
Sellmeyer
Well then umso more Thanks!
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
10/06/06  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.294 Views

Themeninformationen

this Topic has 3 subscriber:

Jörg Sellmeyer (6x)
iF (4x)
unbekannt (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie