Module cHtmlHelp.pkg
1Use windows.pkg
2Use LanguageText.pkg
3Use cHtmlHelp.inc // API Functions and Constants, etc.
4Use GlobalFunctionsProcedures.pkg
5Use HelpSystemConstants.pkg
6
7Register_function phoMainPanel returns integer
8
9
10{ HelpTopic=cHtmlHelp }
11Class cHtmlHelp is a cObject
12 Procedure Construct_Object
13 Forward Send Construct_Object
14
15
16 Move self To ghoHtmlHelp // registers the object-handle globally
17
18 Property String psHelpFile ""
19 Property Handle phoOwner // object that is the owner of the HTML help window
20 Property Boolean pbAlwaysOnTop True // if true, help is always on top.
21
22 { Visibility=Private }
23 Property integer private_piCookie
24
25 Send DoInitialize
26
27 End_Procedure
28
29 { MethodType=Event NoDoc=True }
30 Procedure Destroy_Object
31 Send DoDeInitialize
32 Forward Send Destroy_Object
33 End_Procedure
34
35 // get owner's window handle. if phoOwner not defined use
36 // handle of application objects phoMainPanel. If no owner return 0
37 { Visibility=Private }
38 Function GetOwnerWindowHandle Returns Integer
39 Handle hoOwner
40 // if not always on top we want to use the windows desktop window handle. When the desktop is the owner
41 // you don't get on-top behavior and the help windows does not minimize when you minimize
42 // main program. When the Main panel has the focus, you get the on-top behavior.
43 If (pbAlwaysOnTop(self)) begin
44 Get phoOwner To hoOwner
45 If (hoOwner=0 And ghoApplication) ;
46 Get phoMainPanel Of ghoApplication To hoOwner
47 If hoOwner ;
48 Get window_handle Of hoOwner To hoOwner // the DF objects window handle
49 end
50 // owner will be 0, if we could not find a main active handle or, the more likely
51 // case, pbAlwaysOnTop is set false. Using the windows destkop stops help on top.
52 If (hoOwner=0) Begin
53 Move (GetDesktopWindow()) To hoOwner
54 End
55 Function_Return hoOwner
56 End_Function // GetOwnerWindowHandle
57
58 { Visibility=Private }
59 Function GetHelpFile Returns String
60 String sHelpFile
61 Get psHelpFile to sHelpFile
62 // if name is not directly set object, see if we can get it from the application object
63 If (sHelpFile="" and ghoApplication and peHelpType(ghoApplication)=htHtmlHelp);
64 Get psHelpFile of ghoApplication to sHelpFile
65 If (sHelpFile<>"") Get_File_Path sHelpFile To sHelpFile
66 Function_Return sHelpFile
67 End_Function
68
69 // 5.19.2004 - It appears that using hh_initialize/hh_uninitialze causes keyboard problems with
70 // embedded help which causing ctrl+c to not work. According to messages found on a Newsgroup this
71 // is a known issue and that not using these is the solution. The general advice was to stay
72 // away from these messages - and it does seem to solve the problem (jjt)
73
74 { Visibility=Private }
75 Procedure DoInitialize
76// //Must be sent before any HTML commands can be used
77// Handle hRetVal
78// Integer dwCookie
79// String sBuffer
80// Pointer pBuffer
81
82// Zerotype tDWORD TO sBuffer
83// GetAddress OF sBuffer TO pBuffer
84
85// Move (HtmlHelp(0, "", HH_INITIALIZE, pBuffer)) TO hRetVal
86// GetBuff From sBuffer AT tDWORD.DWord TO dwCookie
87// Set private_piCookie TO dwCookie
88 End_Procedure
89
90 { Visibility=Private }
91 Procedure DoDeInitialize
92// //Must be sent to free resources
93// Dword dwCookie
94// Handle hRetVal
95// String sHelpFile
96// Get private_piCookie TO dwCookie
97
98// Move (HtmlHelp(0, "", HH_UNINITIALIZE, dwCookie))TO hRetVal
99 End_Procedure
100
101 Procedure DoDisplayTopic String sTopic
102 //Most-used command. Pops up the tri-pane Help Viewer.
103 Handle hRetVal
104 Pointer psTopic
105 String sHelpFile
106 GetAddress OF sTopic TO psTopic
107 Get GetHelpFile To sHelpFile
108 If (sHelpFile<>"") Begin
109 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_DISPLAY_TOPIC, psTopic)) TO hRetVal
110 end
111 End_Procedure
112
113 Procedure DoDisplayIndex
114 //Another commonly-used command. Pops up the topic for the current index entry.
115 Handle hRetVal
116 String sHelpFile
117 Get GetHelpFile To sHelpFile
118 If (sHelpFile<>"") Begin
119 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_DISPLAY_INDEX, 0)) TO hRetVal
120 end
121 End_Procedure
122
123 Procedure DoDisplayIndexString String sIndex
124 //Another commonly-used command. Shows the Index, and highlights the sIndex entry
125 Handle hRetVal
126 String sHelpFile
127 Pointer lpsIndex
128 GetAddress of sIndex To lpsIndex
129 Get GetHelpFile To sHelpFile
130 If (sHelpFile<>"") Begin
131 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_DISPLAY_INDEX, lpsIndex)) TO hRetVal
132 End
133 End_Procedure
134
135 Procedure DoShowMapId Integer iMapID
136 //Passed an integer of the MapID allocated to the topic
137 Handle hRetVal
138 String sHelpFile
139 Get GetHelpFile To sHelpFile
140
141 If (sHelpFile<>"") Begin
142 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_HELP_CONTEXT, iMapID)) To hRetVal
143 Send DoDisplayTOC
144 //Send DoSyncToc
145 End
146 End_Procedure
147
148 Procedure DoDisplayKeyword String sKeyword
149 Handle hRetVal
150 Pointer lpsKeyword lpsAkLink lpsErrorText
151 String sHelpFile sAkLink sErrorText
152 GetAddress OF sKeyword TO lpsKeyword
153 Get GetHelpFile To sHelpFile
154 If (sHelpFile<>"") Begin
155
156 Move (SFormat(C_$SorryIsNotInTheIndex, sKeyword)) To sErrorText
157 GetAddress of sErrorText To lpsErrorText
158
159 ZeroType tAkLink To sAkLink
160 Put tAkLink_Size To sAkLink At tAkLink.cbStruct
161 Put 0 To sAkLink At tAkLink.fReserved
162 Put lpsKeyword To sAkLink At tAkLink.pszKeywords
163 Put 0 To sAkLink At tAkLink.pszUrl
164 //Put lpsErrorText To sAkLink At tAkLink.pszMsgText
165 Put 0 To sAkLink At tAkLink.pszMsgText
166 Put 0 To sAkLink At tAkLink.pszMsgTitle
167 Put 0 To sAkLink At tAkLink.pszWindow
168 Put 0 To sAkLink At tAkLink.fIndexOnFail
169
170 GetAddress of sAkLink To lpsAkLink
171
172 Send DoDisplayIndexString sKeyword
173 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_KEYWORD_LOOKUP, lpsAkLink)) TO hRetVal
174 End
175 End_Procedure
176
177 Procedure DoDisplayTOC
178 Handle hRetVal
179 String sHelpFile
180 Get GetHelpFile To sHelpFile
181 If (sHelpFile<>"") Begin
182 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_DISPLAY_TOC, 0)) TO hRetVal
183 End
184 End_Procedure
185
186 Procedure DoSyncToc
187 Handle hRetVal
188 String sHelpFile
189 Get GetHelpFile To sHelpFile
190 If (sHelpFile<>"") Begin
191 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_SYNC, 0)) TO hRetVal
192 End
193 End_Procedure
194
195 { Visibility=Private }
196 Procedure DO_HH_DISPLAY_SEARCH String sTopic
197 Handle hRetVal
198 Pointer psTopic
199 String sHelpFile
200 GetAddress OF sTopic TO psTopic
201 Get GetHelpFile To sHelpFile
202 If (sHelpFile<>"") Begin
203 Move (HtmlHelp(GetOwnerWindowHandle(Self), sHelpFile, HH_DISPLAY_SEARCH, psTopic)) TO hRetVal
204 End
205 End_Procedure
206
207End_Class
208