Advertisement

03.24.2008 at 08:45AM PDT, ID: 23264319
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

VFP Treeview issues with Keyboard

Tags: Microsoft, Visual Fox Pro, 9.0
I'm having several issues working with a Treeview (Active X). In the KeyDown event I set a public variable "KeyCombo" to the key combination being pressed (Ex: KeyCombo="CTRL+M"). In the KeyPress event, I use the value of KeyCombo to do various things... CTRL+M opens up the context menu, CTRL+A adds a new record, CTRL+E edits the current record, etc. The problem I am having is that the KeyPress event does not seem to fire off consistently. Sometimes when I press CTRL+M it works great, and sometimes it doesn't. I always make sure that the control has focus and I also put a wait window in the beginning of the KeyPress event to make sure it wasn't just my code. The wait window does not always appear when I press a combination of keys on the keyboard...

Is it possible that the Active X control is doing some work behind the scenes that is overriding the default keyboard handling? I've run out of ideas for getting it to work consistently. Any help would be greatly appreciated. :D
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: ruscomp
Solution Provided By: CaptainCyril
Participating Experts: 2
Solution Grade: A
Views: 10
Translate:
Loading Advertisement...
03.24.2008 at 09:57AM PDT, ID: 21194822

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:08PM PDT, ID: 21195933

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:13PM PDT, ID: 21195980

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:20PM PDT, ID: 21196040

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:25PM PDT, ID: 21196079

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:50PM PDT, ID: 21196280

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 12:55PM PDT, ID: 21196330

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 01:05PM PDT, ID: 21196424

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 05:17PM PDT, ID: 21198632

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.24.2008 at 05:22PM PDT, ID: 21198651

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 06:45AM PDT, ID: 21201818

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 07:06AM PDT, ID: 21202016

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.25.2008 at 07:13AM PDT, ID: 21202065

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.24.2008 at 09:57AM PDT, ID: 21194822

Rank: Sage

If it's not working in the ActiveX when in focus, let it call the form's Keypress event with the same parameters.
 
03.24.2008 at 12:08PM PDT, ID: 21195933
The treeview is in a class, so in the init of the class, i set the forms KeyPreview to .T., and then bind 'treeview_keypress' (which has all of my logic in it), to the forms KeyPress event. If I press a letter or arrow key, the form's KeyPress event never even fires off ! If I press tab, spacebar, F1, etc, the event fires off. Very strange. Now what?
 
03.24.2008 at 12:13PM PDT, ID: 21195980

Rank: Sage

Did you check the events programmed in the class?
 
03.24.2008 at 12:20PM PDT, ID: 21196040
Not sure exactly what you mean...

The class definitely has nothing that is overwriting the KeyPreview property's value or KeyPress event.
The treeview itself is in the 1st page of a pageframe (the pageframe is the class)
 
03.24.2008 at 12:25PM PDT, ID: 21196079

Rank: Sage

Well have you added any code in the Keypress event of the class once pasted on the form? Like WAIT WINDOW or MESSAGEBOX?
 
03.24.2008 at 12:50PM PDT, ID: 21196280
Yes, I have a WAIT WINDOW in the method that I am binidng to the form's KeyPress event (to show me when the event is actually firing off. And actually, the event does not fire off with the spacebar or F2,F3, etc. keys, only the TAB key.
 
03.24.2008 at 12:55PM PDT, ID: 21196330

Rank: Sage

Very wierd.

I had that problem before and the way I solved it is by calling the form's Keypress Event from the ActiveX's Event.
Accepted Solution
 
03.24.2008 at 01:05PM PDT, ID: 21196424
Well I can't exactly call it from within the Treeview's KeyPress event because it's only parameter is 'keyascii', which would be hard to split into the form's Keypress 'nKeyCode' & 'nShiftAltCtrl '. So like I said, I'm binding my method to the form's KeyPress event.

Maybe there is something I misunderstood?
(And btw, thank you CaptainCyril for all your help so far.)
 
03.24.2008 at 05:17PM PDT, ID: 21198632

Rank: Genius

Give this a try and see whether it helps or not:

Issue the =SYS(2333,0) command prior to the instantiation of the TreeView control.

PRB: TreeView Control HitTest Method Returns Empty String
http://support.microsoft.com/kb/168060/en-us
 
03.24.2008 at 05:22PM PDT, ID: 21198651

Rank: Genius

And take a look at setting the AutoYield property:

AutoYield Property
http://msdn2.microsoft.com/en-us/library/tzw0kthk(VS.80).aspx

The AutoYield property should be set to false (.F.) when a form contains an ActiveX control. Setting AutoYield to false (.F.) prevents events for an ActiveX control from executing between lines of user program code. For example, if AutoYield is set to true (.T.), clicking an ActiveX control while user program code is executing may cause an event for the ActiveX control to execute, ignoring the user program code for the event, producing undesirable or unpredictable results.

The following occurs when the AutoYield property is set to false (.F.):

ActiveX controls cannot process events until a wait state occurs, so clicking an ActiveX control has no effect while user program code is executing. This is the same behavior for Visual FoxPro controls such as the Grid.

ON KEY LABEL commands and mouse events are ignored while user program code is executing. The ON KEY LABEL commands and mouse events are placed in a queue and processed at the next wait state.

Pressing Esc does not interrupt program execution. This is identical to setting ESCAPE to OFF. In this case you cannot exit infinite loops without shutting down the instance of Visual FoxPro.

Queries cannot be interrupted.

Switching to other applications is supported, but you cannot switch back to Visual FoxPro while Visual FoxPro user program code is executing.
Assisted Solution
 
03.25.2008 at 06:45AM PDT, ID: 21201818
Tried playing around with both the SYS(2333,0) AND AutoYield as you suggested Carl, and still nothing. However, I will leave them in the application though because I'm sure they may benefit me later. Thank you for the suggestions.
 
03.25.2008 at 07:06AM PDT, ID: 21202016
Not exactly sure what did it, but the consistency seemed to come back after reverting the class back to it's original state and then reinserting my code.
The way I have it set up now, I am calling my keydown method from the activex's keydown and my keypress method from the activex's keypress (And passing in the parameters as neccessary).
 
03.25.2008 at 07:13AM PDT, ID: 21202065
Just a note: I set AutoYield back to True And commented out SYS(2333,0), closed VFP and then ran again, just to check if they affected it and did not see any difference.
 
 
20080716-EE-VQP-33 / EE_QW_2_20070628