qwert Posted February 4, 2014 Posted February 4, 2014 I've tried several style combinations, but haven't been able to activate the standard right-click menu (Cut/Copy/Paste) for a Rich Text Field. Yet, it's a default feature of normal text fields. This brief example shows the difference: #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Edit RTF", 320, 240, -1, -1) $TextInput = GUICtrlCreateEdit("This is a normal text field. You can highlight text and right-click to get option to Copy.", _ 20, 20, 240, 60, BitOR ($WS_VSCROLL, $ES_AUTOVSCROLL)) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a rich text field. You can highlight text ... and CTRL-V works ... but there is no right-click menu.", _ 20, 120, 240, 60, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState() While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Exit EndSelect WEnd Can anyone shed light on this? What rules govern right-click menus? (CreateMenu, of course, can add an edit menu for the entire window ... and those features work for both text types. But I'm working with a frameless GUI without a menu bar.) Thanks in advance for any help.
Moderators Melba23 Posted February 4, 2014 Moderators Posted February 4, 2014 qwert,Edit and Input (which is just a forced single-line Edit) controls have system context menus - that is what you are seeing when you right click and why the Help file for GUICtrlCreateContextMenu tells you that you cannot use it on that type of control. For a RichEdit control, you need to create your own context menu - and a quick search of the forum (the box is at top right) brought up this thread as the first hit, which works very nicely. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
qwert Posted February 5, 2014 Author Posted February 5, 2014 Thanks, Melba23. "context menu" was the term I was missing. I had searched for "right-click" and "cut", "copy", etc., ... without hitting the right track. The menu is now coming up for the Rich Text field and the three actions seem to work ... but the cursor pointer isn't always reset to an arrow. So I think I might not have the Case statements quite right. Is there a better way than what I have?: Case $WM_COMMAND Switch $wParam Case $idCut Send("^x") Case $idCopy Send("^c") Case $idPaste Send("^v") EndSwitch Thanks for any advice.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now