Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cut and paste selected text only
#1
How do I cut and paste only the selected text from a dialog edit field? And not all text like in this section of my script (where e3 is the edit field, case 4 and 5 cut-and-paste all text but case 6 is supposed to cut and paste only the text that was selected):

Code:
Copy      Help
str controls = "3"
str e3
;g1
int r=ShowDialog(dd &sub.DlgProc &controls)
;
sel r
,case 4
,if(!empty(e3))
,,paste e3
,case 5
,if(!empty(e3))
,,paste e3
,,e3.all
,,,,key V           ;; Space
,,goto g1
,case 6
,,,,,

,ret
#2
read qm help getsel

http://www.quickmacros.com/help/str/IDP_S_CLIP.html

basic example will get selected text 


Code:
Copy      Help
int c=id(3 hDlg) ;;editable text
str s.getsel(0 0 c)
out s


read more about cut options in help
#3
Thanks Kevin, yes I already read that section but inserting this into the script gives unknown identifier error with hDlg:


Code:
Copy      Help
case 6
,,,int c=id(3 hDlg) ;;editable text
str s.getsel(0 0 c)
out s
#4
The error is because hDlg is only known inside the dialog. You will need to get the selected text before the dialog closes.
#5
I see. Okay I will edit the code accordingly.

Thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)