rdhays82604 wrote:Great job on your editor Paul!
1) I would like to have a popup menu when I right-click on a text box. How can I do this.
2) How do I get the text from a textbox control array?
3) Will you be implementing a "DataGridView" control?
(1) I assume you want the popup in a RichEdit control? (regular TextBoxes should automatically show a popup menu). Here is some PB code that shows what to do. Should be easy to port the code to FB:
Code: Select all
%IDC_RICHEDIT_UNDO = %WM_USER + 101
%IDC_RICHEDIT_CUT = %WM_USER + 102
%IDC_RICHEDIT_COPY = %WM_USER + 103
%IDC_RICHEDIT_PASTE = %WM_USER + 104
'//
'// Create and show the right-click popup menu for the RichEdit textboxes
'//
Function ShowRichEditPopup() As Long
If g.hRightClickPopup Then DestroyMenu g.hRightClickPopup
g.hRightClickPopup = CreatePopupMenu()
AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_UNDO, "Undo"
AppendMenu g.hRightClickPopup, %MF_SEPARATOR, 0, ""
AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_CUT, "Cut"
AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_COPY, "Copy"
AppendMenu g.hRightClickPopup, %MF_STRING, %IDC_RICHEDIT_PASTE, "Paste"
End Function
'--------------------------------------------------------------------------------
Function FRMPROJNOTES_CUSTOM ( _
hWndForm As Dword, _ ' handle of Form
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Select Case wMsg
Case %WM_CONTEXTMENU
ShowRichEditPopup
Local pt As PointApi
GetCursorPos pt
TrackPopupMenu g.hRightClickPopup, %TPM_LEFTALIGN Or _
%TPM_LEFTBUTTON, pt.x, _
pt.y, 0, hWndForm, ByVal %Null
End Select
End Function
'--------------------------------------------------------------------------------
Function FRMPROJNOTES_WM_COMMAND ( _
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
wNotifyCode As Long, _ ' notification code
wID As Long _ ' item, control, or accelerator identifer
) As Long
Select Case wID
Case %IDC_RICHEDIT_UNDO
SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %EM_UNDO, 0, 0
Case %IDC_RICHEDIT_CUT
SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %WM_CUT, 0, 0
Case %IDC_RICHEDIT_COPY
SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %WM_COPY, 0, 0
Case %IDC_RICHEDIT_PASTE
SendMessage HWND_FRMPROJNOTES_RICHEDIT1, %WM_PASTE, 0, 0
End Select
End Function
(2) Code from a textbox control array can be gotten from using the FF_TextBox_GetText function. The first parameter would be the Windows handle of the control. eg. FORM1_TEXTBOX1(0). Notice that the handle is actually an array FORM1_TEXTBOX1(0), FORM1_TEXTBOX1(1), FORM1_TEXTBOX1(2), etc....
If you are trying to get the text from a RichEdit control then you need to deal with the EM_STREAMOUT message. I didn't port my PB version of the FF_RichEdit_GetText function to FB. Not sure why... :) Do a search of this forum for EM_STREAMOUT. There should be examples here.
(3) No plans for a data grid control. Sorry.