Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OKL Passing Parameters
Message
 
To
26/06/2001 08:07:30
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00523099
Message ID:
00523633
Views:
15
>Ok, ok... Y'all are having an awful lot of fun at my expense here! :) I wanted to do the HelpContextID, but it still means that I have to maintain and keep track of the relationship between the ID and the object. To make this even harder, the user insists to have the ability to add help for objects on the fly. This in itself is not difficult when I pass the object name and the hierarchy information, but it's impossible using the ID as it has to be manually maintained. Unless I don't understand how it is supposed to work. The ID would make sense if it were a unique number that Foxpro assigned, but as I understand it I would have to keep track of the relationship.
>
>What IS the best way to handle help? Even foregoing the user-adding logic, doesn't it seem that there should be an easier way to automatically handle help at the object level? Or all levels?
>
>And why is the ActiveControl unreliable? I can see that it is because even with the debugger not running it will not return a valid ActiveControl value from any of the objects on my form, but why?
>
>...and thanks for allowing me to be the straight man earlier... :)
>
Mr. Straight, :D

I think the HelpContextID does allow you to manage help fairly efficiently. Hopefully, you're only using subclasses of the base controls in your project. If so, you can take advantage of the OO hierarchy when designing help.

ie. consider a project with these hypothetical classes:
Class             HelpContextID
textbox           0
  txt             1
    txtRed        27
      txtOrange   152
    txtBlue       28
      txtCyan     28
Pressing F1 while the focus is on any textbox will show at least the txt help. If you don't specify a HelpContextID for a subclass of the txt object, it will automatically default to the help of the parent class.

If you don't like having to maintain the list of objects and HelpContextIDs, you could create a routine to pull the info out of your libraries.

ie
LOCAL ARRAY laFiles[1]
LOCAL lcHCID, lnI

CLOSE DATA ALL
CREATE CURSOR HelpInfo (ObjName C(25), HelpContextID I)
SELECT 2
FOR lnI = 1 TO ADIR(laFiles,"libs\*.vcx")
  USE ("libs\" + laFiles[lnI,1]) IN 2 EXCL ALIAS Lib
  SCAN FOR "LEFT" $ UPPER(Properties) AND !DELETED()
    lcHCID = SUBSTR(Lib.Properties,AT("LEFT",UPPER(Lib.Properties)) + LEN("LEFT"))
    lcHCID = CHRTRAN(lcHCID,"=","")
    INSERT INTO HelpInfo VALUES (Lib.ObjName, VAL(lcHCID))
  ENDSCAN
ENDFOR
USE IN 2
SELECT MAX(HelpContextID) + 1 FROM HelpInfo will give you the next unique ID.

You could expand this code to update a table that tracks ObjName, HelpContextID and HelpText.

As for the ActiveControl... I've found it to be more reliable than it seems to be for you, but it does have attitude ;) Show me your form's KeyPress code.
Brien R. Givens

Brampwood Systems
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform