×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Binding Events to DEFINEd WINDOWs

Binding Events to DEFINEd WINDOWs

Binding Events to DEFINEd WINDOWs

(OP)
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 --> VFP

SELECT COMMANDS
DEFINE WINDOW xCode IN DESKTOP FROM 10, 10 TO 40, 200  TITLE "EDIT TEXT" FLOAT GROW ZOOM CLOSE NAME xEDITOR FONT "Inconsolata", 12
MODIFY COMMAND ".\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 --> VFP

BINDEVENT(hWnd | 0, nMessage, oEventHandler, cDelegate [, nFlags]) 

Any ideas would be appreciated...

Dennis Kean

Simplicity is the extreme degree of sophistication.
Leonardo da Vinci

RE: Binding Events to DEFINEd WINDOWs

(OP)
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

RE: Binding Events to DEFINEd WINDOWs

Quote (dkean4)

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.

RE: Binding Events to DEFINEd WINDOWs

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

In this case, you could do the DEFINE WINDOW 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. hWnd 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

RE: Binding Events to DEFINEd WINDOWs

(OP)
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

RE: Binding Events to DEFINEd WINDOWs

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close