Re: Copy contents of code/editor window with formatting

2022-02-07 Thread Christof Wollenhaupt
> BTW - ISX - Is that InstallShield Express?

No, that's my original IntelliSense alternative for VFP 6 written at a time 
when we called everything soandsoX. 

https://bitbucket.org/cwollenhaupt/foxpert.tools.isx/src/master/ 


There's am enhanced version called IntelliSenseX that is part of Thor:

https://github.com/VFPX/IntelliSenseX 

-- 
Christof

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/6455b219-12a3-4860-a40d-cb977118b...@wollenhaupt.org
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


RE: Copy contents of code/editor window with formatting

2022-02-07 Thread paul.newton.hudl
Hi Christof

Many, many thanks for your reply.  It looks like just what I need and I will
try it out later today.  

In the meantime I have come up with a different approach for the time being.
I have created a form with an RTF OLE control and an edit box.  I run the
form using CTRL+F10.  In my editing window I use CTRL+A, CTRL+C.  Pressing
CTRL+F10 brings up my form and in the RTL OLE control I press CTRL+V.

In the Change method/event of the RTF control I set the value of the edit
box to the TextRTF property of the control.

BTW - ISX - Is that InstallShield Express?

Thanks again

Paul

-Original Message-
From: ProfoxTech  On Behalf Of Christof
Wollenhaupt
Sent: 07 February 2022 06:43
To: profoxt...@leafe.com
Subject: Re: Copy contents of code/editor window with formatting

Hi Paul,

> 1.I want it to work with the current/open editing window

in ISX I use the following code:

*-
* Get the current window and verify that it is a valid window.
*-
Local lnWHandle
lnWHandle = GetCurrentWindow()
If lnWHandle == 0
If not Empty(m.tcInvocation)
Clear TypeAhead
Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
Endif
Return
Endif

*-
* Verify that the current window is indeed an edit window.
*-
Local lnEditSource 
lnEditSource = GetEditSource(m.lnWHandle)
If not InList( m.lnEditSource, 1, 8, 10, 12 )
If not Empty(m.tcInvocation)
Clear TypeAhead
Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
Endif
Return
EndIf

*
* Determines the source of the window identified by the passed 
* WHandle. It returns the following values:
*
* -1 The window is not an edit window
*  0 Command Window
*  1 MODIFY COMMAND window
*  2 MODIFY FILE window
*  8 Menu Designer code window
* 10 Method Edit Window in Class or Form Designer
* 12 MODIFY PROCEDURE window
*
* This procedure uses _EdGetEnv() from the FoxTools.Fll to determine
* the edit source. Passing an invalid handle causes an exception in
* VFP 5 and VFP 3. In VFP 6 this raises an error 2028 (API function
* caused an exception). Therefore we return -1 in this case, too.
*
Procedure GetEditSource
LParameter tnWHandle

Local laEnv[25], lnSource, lnOK, lcError
lcError = On( "Error" )
On Error lnOK = 0
lnOK = _EdGetEnv( m.tnWHandle, @laEnv )
On Error 
If m.lnOK == 0
lnSource = -1
Else
lnSource = laEnv[25]
Endif

Return m.lnSource


*
* Returns the WHandle of the current edit window or 0, if no edit
* window is available.
*
Procedure GetCurrentWindow

Local lnWindowOnTop
lnWindowOnTop = _WOnTop()
If m.lnWindowOnTop <= 0
Return 0
Endif
If GetEditSource( m.lnWindowOnTop ) == -1
lnWindowOnTop = 0
Endif

Return m.lnWindowOnTop


-- 
Christof



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/006601d81c2f$9c17dd80$d4479880$@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


RE: Copy contents of code/editor window with formatting

2022-02-07 Thread paul.newton.hudl
Hi Andy, thanks for your reply.

Yes but that displays the rendered RTF and I want to work with the underlying 
RTF (including the various tags - e.g. font name, size, weight, style, colour 
etc)

Paul

-Original Message-
From: ProfoxTech  On Behalf Of AndyHC
Sent: 07 February 2022 07:19
To: profoxt...@leafe.com
Subject: Re: Copy contents of code/editor window with formatting

I don't know about automating it but this seems to work in the edit window:
Ctl_A  Ctl_C  -> in e.g. Word - Ctl_V  - save as  type .rtf


On 07-Feb-22 5:19 AM, paul.newton.h...@gmail.com wrote:
> Hi all
>
>   
>
> I am trying to copy the contents of the editing window that is 
> currently active (i.e. that I am editing) as text with its RTF 
> formatting code.  What I have got (cribbed) so far is this:
>
>   
>
> SET LIBRARY TO (HOME()+"Foxtools.FLL")
>
> nWHAND =_EDOPENFIL("TEST.PRG", 1)
>
> nEDstart = _EDSKIPLIN(m.nWHAND,0,0)
>
> nEDend   = _EDSKIPLIN(m.nWHAND,0,10)
>
> = _EDSELECT(m.nWHAND, m.nEDstart, m.nEDend)
>
> = _EDCOPY(m.nWHAND)
>
> = _EDCLOSEFI(m.nWHAND, 0)
>
>   
>
> This works fine insofar as I can paste the code into Word and see that 
> the code highlighting is correct.  But there are a couple of issues I 
> haven't yet been able to resolve:
>
>   
>
> 1.I want it to work with the current/open editing window
> 2.I want to work with the underlying RTF, i.e. the text together with
> the RTF formatting tags
>
>   
>
> I expect to invoke the code to do this via a hotkey so that the window 
> that I am working on will be the active window.  Any help or 
> suggestions would be much appreciated.  Many thanks.
>
>   
>
> Paul Newton
>
>
>
> --- StripMime Report -- processed MIME parts --- multipart/alternative
>text/plain (text body -- kept)
>text/html
> ---
>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/005a01d81c1f$8c754850$a55fd8f0$@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Re: Copy contents of code/editor window with formatting

2022-02-06 Thread AndyHC

I don't know about automating it but this seems to work in the edit window:
Ctl_A  Ctl_C  -> in e.g. Word - Ctl_V  - save as  type .rtf


On 07-Feb-22 5:19 AM, paul.newton.h...@gmail.com wrote:

Hi all

  


I am trying to copy the contents of the editing window that is currently
active (i.e. that I am editing) as text with its RTF formatting code.  What
I have got (cribbed) so far is this:

  


SET LIBRARY TO (HOME()+"Foxtools.FLL")

nWHAND =_EDOPENFIL("TEST.PRG", 1)

nEDstart = _EDSKIPLIN(m.nWHAND,0,0)

nEDend   = _EDSKIPLIN(m.nWHAND,0,10)

= _EDSELECT(m.nWHAND, m.nEDstart, m.nEDend)

= _EDCOPY(m.nWHAND)

= _EDCLOSEFI(m.nWHAND, 0)

  


This works fine insofar as I can paste the code into Word and see that the
code highlighting is correct.  But there are a couple of issues I haven't
yet been able to resolve:

  


1.  I want it to work with the current/open editing window
2.  I want to work with the underlying RTF, i.e. the text together with
the RTF formatting tags

  


I expect to invoke the code to do this via a hotkey so that the window that
I am working on will be the active window.  Any help or suggestions would be
much appreciated.  Many thanks.

  


Paul Newton



--- StripMime Report -- processed MIME parts ---
multipart/alternative
   text/plain (text body -- kept)
   text/html
---


[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/f9cecd43-9f87-5212-e075-3cabf12e9...@hawthorncottage.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Re: Copy contents of code/editor window with formatting

2022-02-06 Thread Christof Wollenhaupt
Hi Paul,

> 1.I want it to work with the current/open editing window

in ISX I use the following code:

*-
* Get the current window and verify that it is a valid window.
*-
Local lnWHandle
lnWHandle = GetCurrentWindow()
If lnWHandle == 0
If not Empty(m.tcInvocation)
Clear TypeAhead
Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
Endif
Return
Endif

*-
* Verify that the current window is indeed an edit window.
*-
Local lnEditSource 
lnEditSource = GetEditSource(m.lnWHandle)
If not InList( m.lnEditSource, 1, 8, 10, 12 )
If not Empty(m.tcInvocation)
Clear TypeAhead
Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
Endif
Return
EndIf

*
* Determines the source of the window identified by the passed 
* WHandle. It returns the following values:
*
* -1 The window is not an edit window
*  0 Command Window
*  1 MODIFY COMMAND window
*  2 MODIFY FILE window
*  8 Menu Designer code window
* 10 Method Edit Window in Class or Form Designer
* 12 MODIFY PROCEDURE window
*
* This procedure uses _EdGetEnv() from the FoxTools.Fll to determine
* the edit source. Passing an invalid handle causes an exception in
* VFP 5 and VFP 3. In VFP 6 this raises an error 2028 (API function
* caused an exception). Therefore we return -1 in this case, too.
*
Procedure GetEditSource
LParameter tnWHandle

Local laEnv[25], lnSource, lnOK, lcError
lcError = On( "Error" )
On Error lnOK = 0
lnOK = _EdGetEnv( m.tnWHandle, @laEnv )
On Error 
If m.lnOK == 0
lnSource = -1
Else
lnSource = laEnv[25]
Endif

Return m.lnSource


*
* Returns the WHandle of the current edit window or 0, if no edit
* window is available.
*
Procedure GetCurrentWindow

Local lnWindowOnTop
lnWindowOnTop = _WOnTop()
If m.lnWindowOnTop <= 0
Return 0
Endif
If GetEditSource( m.lnWindowOnTop ) == -1
lnWindowOnTop = 0
Endif

Return m.lnWindowOnTop


-- 
Christof



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/edcf902b-5506-4043-a70b-6ef032e3d...@wollenhaupt.org
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.