Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding Events to DEFINEd WINDOWs

Status
Not open for further replies.

dkean4

Programmer
Feb 15, 2015
282
0
0
US
I use DEFINE WINDOW and MODIFY COMMAND to create an Editing window for VFP code, for on the fly changes while running a VFP app. The code resides in a Memo field, but MODIFY MEMO does not invoke the VFP Code Editor with all the bells and whistles. Here is the code for the process:

Code:
SELECT COMMANDS
[b]DEFINE WINDOW[/b] xCode IN DESKTOP FROM 10, 10 TO 40, 200  TITLE "EDIT TEXT" FLOAT GROW ZOOM CLOSE NAME xEDITOR FONT "Inconsolata", 12
[b]MODIFY COMMAND[/b] ".\Concept_Projects\Temp.txt" WINDOW xCode NOWAIT

I would like to bind an event to the window "xCode" which comes up and I do not know how to get the hWnd value of the window needed for the BINDEVENT() function.

Code:
BINDEVENT([b]hWnd[/b] | 0, nMessage, oEventHandler, cDelegate [, nFlags])

Any ideas would be appreciated...

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Thanks Mike. Stupid question when you know that the window NAME is also the object reference. It had not occurred to me.

Olaf, you don't miss anything. Yeah, but I was asking something else about it. Which I solved a while back with your and the other guy's suggestions.


Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
dkean4 said:
when you know that the window NAME is also the object reference. It had not occurred to me.
Well, you can start many forms with Name="Form1" and won't have that. Use _screen.forms(_screen.formscount) for refering to the latest form you started or _screen.activeform for the active form.
You'll see _screen.formcount will increase if you DEFINE WINDOW.

Bye, Olaf.

 
Another way of getting this sort of information is with the debugger.

In this case, you could do the [tt]DEFINE WINDOW[/tt] in the command window, then look at the Locals page in the debugger. You should recognise the name of the window object (xEDITOR in this case). You can then drill down into object to see its properties. [tt]hWnd[/tt] would be one of those.

Of course, once you know the name of the object, you could also use Intellisense.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you Olaf,

I use this code, now, after trying all sorts of ways, mainly because it is simple or sufficient. It allows me to edit code with the full array of the VFP IDE. So, though I wanted much more, before, this does just fine...

DEFINE WINDOW xCode IN DESKTOP FROM 0,0 TO 70,100 FLOAT GROW ZOOM CLOSE NAME xCodes FONT "Inconsolata", 12
MODIFY COMMAND ".\Concept_Projects\Temp_Edits\Temp_Code.prg" WINDOW xCode

Thanks for the tips... very appreciated...


Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Mike Lewis

Thanks for the tips. For some reason, though I use the debugger and local windows all day long, when I do VFP coding, I missed the whdl etc. Thank you for your patience and kindness.





Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top