Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SelectedTesc>>variable?
Message
From
25/03/2002 11:53:12
 
 
To
24/03/2002 15:01:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00636545
Message ID:
00636879
Views:
18
Daniel,
I don't want the whole text in the method. I just want the line that the cursor is setting on. Do you have that FUNTION available? If not I'll figure it out myself.

Thanks.



>Bill,
>
>You can get the text without first selecting it. Since you already use FoxTools, you can simply do the following:
>
>
>ON KEY LABEL F12 STORE GetEditorText() TO _CLIPTEXT
>
>
>
>FUNCTION GetEditorText
>
>*-- editor session types
>#DEFINE cnCommandWindow  0
>#DEFINE cnProgramFile    1
>#DEFINE cnTextEditor     2
>#DEFINE cnMenuEditor     8
>#DEFINE cnMethodEditor  10
>#DEFINE cnStoredProc    12
>
>SET LIBRARY TO FOXTOOLS ADDITIVE
>
>lnWhandle = _WonTop()
>
>DIMENSION laEnvironment[25]
>
>IF _EdGetEnv(lnWhandle, @laEnvironment) = 1
>
>  IF INLIST(laEnvironment[25], cnCommandWindow,;
>                               cnProgramFile,;
>                               cnTextEditor,;
>                               cnMenuEditor,;
>                               cnMethodEditor,;
>                               cnStoredProc;
>            )
>
>    lcRetVal = _EdGetStr(lnWhandle, 0, laEnvironment[2])
>  ELSE
>    lcRetVal = ""
>  ENDIF
>ELSE
>  *-- _EdGetEnv() failed
>  lcRetVal = ""
>ENDIF
>
>RETURN lcRetVal
>
>
>BTW, this stuff is easy thanks to George Tasker's great Extended Foxtools Help. I think you can download it from the UT.
>
>>I found my own answer.
>>In the prg:
>>"keyboard '{Home}{Shift+End}{Ctrl+M}'
>>suspend
>>
>>this lets the text get selected the resumes the prg.
>>
>>Thanks Again.
>>
>>
>>>Hi Sergey,
>>>This was just what I asked for. Unfortunately after I got it working, I found out that I need more.
>>>Do you know how I can have a prg execute "keyboard '{HOME}{SHIFT+END}'" and then put the selected text into the clipboard?
>>>
>>>_EdCopy(lnHandle) works great if I've already selected the text. But when the prg tries to do it, the keyboard doesn't execute until the prg ends (ie: nothing is selected until AFTER the _EdCopy() is run.
>>>
>>>I suppose I could run 2 OKL commands 1. to select the line and 2. to copy it into the clipboard.
>>>
>>>
>>>>Here's how you can get selected text into clipboard
SET LIBRARY TO (Home() + "FoxTools") ADDITIVE
>>>>*** Get the whandle for the current window
>>>>lnHandle = _WonTop()
>>>>= _EdCopy(lnHandle )
The rest is easy.
>>>>
>>>>
>>>>>In the form designer is there any way I can select text and put it into a variable or pass the text to a prg or in any other way have some prg read what I've selected.
>>>>>
>>>>>I'm currently using KEYBOARD to cut & paste the text into the command window. It's getting the job done, but I'd like to find something more elegant.
>>>>>
>>>>>I'm doing something like this:
>>>>>
>>>>>on key label CTRL+LBRACKET do Copy_Text
>>>>>
>>>>>procedure Copy_Text
>>>>>  keyboard [{CTRL+C}{CTRL+F2}Do Analyse_Text with '{CTRL+V}'{ENTER}]
>>>>>  ** It's not quite this simple, but you get the idea.
>>>>>
>>>>>procedure Analyse_Text(tcTextToAnalyse)
>>>>>  ... Analyse Text
>>>>>
>>>>>Is there a better way?
>>>>>
>>>>>
>>>>>TIA
Bill Morris
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform