Peter Stephensen published an example of PopUp-menu in
Source-code forum.Mine is a variation of that.
As discussions is not proper in that forum I have raised
this questions here.
I have learned that the proper way to handle popup-menues
generated via right-click or Shift/F10 is via
%WM_CONTEXTMENU message.
In the code below I have a question.
Why are the returned handle for static (label/frame/image) not
the actual handle. Instead it is the owning window's handle
that is returned.
In the case of EDIT (TextBox) I have a vauge idea
-------------
Fred
mailto:[email protected][email protected]</A>
http://www.oxenby.se
[This message has been edited by Fred Oxenby (edited February 05, 2000).]
Source-code forum.Mine is a variation of that.
As discussions is not proper in that forum I have raised
this questions here.
I have learned that the proper way to handle popup-menues
generated via right-click or Shift/F10 is via
%WM_CONTEXTMENU message.
In the code below I have a question.
Why are the returned handle for static (label/frame/image) not
the actual handle. Instead it is the owning window's handle
that is returned.
In the case of EDIT (TextBox) I have a vauge idea
Code:
#Compile Exe #Include "win32api.inc" %IDM_TEST1 = 101 %IDM_TEST2 = 102 %IDM_TEST3 = 103 %IDM_TEST4 = 104 Declare CallBack Function DlgProc Global ghDlg As Long Global Id()As Long Function PbMain ReDim Id(200 To 206)As Long Dim S(1 To 5)As String S(1)="Line1" S(2)="Line2" S(3)="Line3" S(4)="Line4" S(5)="Line5" Dialog New 0, "Right click !",,,400,300, %DS_CENTER Or %WS_SYSMENU Or %WS_MINIMIZEBOX To ghDlg Id(200)=ghDlg Control Add TextBox, ghDlg,201,"Fred",10,10,100,15 Control Add Label, ghDlg,202,"Label",10,30,100,15 Control Add Button, ghDlg,203,"Button",10,50,100,15 Control Add Frame , ghDlg,204,"Frame",10,70,100,15 Control Add ListBox, ghDlg,205,S(),10,90,100,35 Control Add ComboBox,ghDlg,206,S(),10,130,100,55 Control Add Image, ghDlg,207,"#1000",10,150,100,50 Control Add Button, ghDlg, %IDCANCEL, "&Exit", 350, 255, 40, 14 For i& = 201 To 207:Id(i&)=GetDlgItem(ghDlg,i&):Next i& Dialog Show Modal ghDlg Call DlgProc End Function CallBack Function DlgProc Local pt As POINTAPI Local x As Long,y As Long Local hPopup As Long Select Case CbMsg Case %WM_CONTEXTMENU x = LoWrd(CbLparam) : y = HiWrd(CbLparam) If (x=65535) Or (y=65535) Then 'Get the LOC of the control in focus End If Array Scan Id(),=CbCtl,To r& #Debug Print Format$(199 + r&)& " => " & Format$(CbCtl) Menu New Popup To hPopup Menu Add String, hPopup, "First Choice", %IDM_TEST1, %MF_ENABLED Menu Add String, hPopup, "Second Choice", %IDM_TEST2, %MF_ENABLED Menu Add String, hPopup, "Third Choice", %IDM_TEST3, %MF_ENABLED Menu Add String, hPopup, "Best Choice", %IDM_TEST4, %MF_ENABLED TrackPopupMenu hPopup, %TPM_LEFTALIGN Or %TPM_RIGHTBUTTON, x, y, 0, ghDlg, ByVal 0 Case %WM_COMMAND Select Case LoWrd(CbWparam) Case %IDCANCEL Dialog End CbHndl Case %IDM_TEST1 MsgBox "%IDM_TEST1" Case %IDM_TEST2 MsgBox "%IDM_TEST2" Case %IDM_TEST3 MsgBox "%IDM_TEST3" Case %IDM_TEST4 MsgBox "%IDM_TEST4" End Select End Select End Function
-------------
Fred
mailto:[email protected][email protected]</A>
http://www.oxenby.se
[This message has been edited by Fred Oxenby (edited February 05, 2000).]
Comment