|
My implementation of context sensitive help uses a table of topic id's given from my help compiler (RoboHelp).
Each one refers to either a window name or a window and datawindow combination.
The topic description is optional.
Table help_topics
| Column |
Data Type |
| help_topic_id |
integer or long |
| object_reference |
char(100) |
| topic_description |
char(100) |
Sample Data
| help_topic_id |
object_reference |
topic_description |
| 1 |
w_customers |
Customers |
| 2 |
w_customers.dw_customers |
Customers |
| 3 |
w_customers.dw_contacts |
Customer Contacts |
| 3 |
w_preferences |
Preferences |
Menu Code
Finally a Menu Item called Context Help and define it's shortcut as Shift-F1.
Add this code to the clicked event.
//---------------------------------------------------------------------------
// Event Name : clicked for m_context_help
// Purpose : Open Context Sensitive Help
// Sets : None
//---------------------------------------------------------------------------
window lw_focus
string ls_window_name
string ls_help_keyword
string ls_object_reference
long ll_topic_id
graphicobject lgro_curfocus
// Check that the Window is not the MDI window
IF Pos(this.ParentWindow.ClassName(), "mdi") = 0 THEN
lw_focus = this.ParentWindow
lgro_curfocus = GetFocus()
IF IsValid(lw_focus) THEN
ls_window_name = lw_focus.ClassName()
CHOOSE CASE TypeOf(lgro_curfocus)
CASE DataWindow!
ls_object_reference = ls_window_name + "." + lgro_curfocus.ClassName()
CASE ELSE
ls_object_reference = ls_window_name
END CHOOSE
SELECT help_topics.help_topic_id
INTO :ll_topic_id
FROM help_topics
WHERE help_topics.object_reference = :ls_object_reference;
IF SQLCA.SQLCODE = 0 THEN
ShowHelp(gs_help_file, Topic!, ll_topic_id)
ELSE
MessageBox("Error", "Help reference to '" + ls_object_reference &
+ "' cannot be found", StopSign!)
Run("Winhlp32 " + gs_help_file)
END IF
END IF
ELSE
Run("Winhlp32 " + gs_help_file)
END IF
|