• Welcome to Theos PowerBasic Museum 2017.

how does pbedit do F1 ?

Started by Paul Breen, September 28, 2008, 02:51:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul Breen

I want to use a second textbox on a dialog that is hidden from the user but fully functional to the programmer. I want to use it as a container for pasting from the clipboard.

Is this possible? I am trying to implement a F1 funtion that works like pbedit so that all the user has to do is put the cursor inside a word and the F1 key does the rest. How do they do it?
thanks,
Paul Breen

Patrice Terrier


I think that they just parse the underlaying word, then search for it in their BTree index.

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

 
Yes. First get the word that you want to search for and then use:


#INCLUDE "HTMLHELP.INC"   ' For HtmlHelp, HH_AKLINK and HH_xxx constants

LOCAL hlk AS HH_AKLINK

hlk.cbStruct     = SIZEOF(hlk)
hlk.pszKeywords  = STRPTR(buffer)   ' word to search
hlk.fIndexOnFail = %TRUE

' where szPath contains the path of the .chm file
HtmlHelp hWnd, szPath, %HH_DISPLAY_TOPIC, %NULL
HtmlHelp hWnd, szPath, %HH_KEYWORD_LOOKUP, VARPTR(hlk)


Paul Breen

Quote from: Patrice Terrier on September 28, 2008, 08:36:17 AM

I think that they just parse the underlaying word, then search for it in their BTree index.
...
Sure, but pbedit does it without the mouse, the mouse x & y in the helpinfo data structure is not much use. I can parse the word if I make the user select or highlight the word (using getselect) but that is less elegant than the pbedit approach. The help info struct only gives part of what I need.  ???

Dominic Mitchell

#4
PBEdit is not doing anything special, because it is exactly as José said.
The F1 key does not do anything.
When the F1 key is pressed and released, the OS sends a WM_HELP message, and
it is at this point that the programmer employs smoke and mirrors.  That is,
you figure out which word is closest to the caret and then do a lookup.
The HELPINFO struct is of little use or not even used in this scenario.
Dominic Mitchell
Phoenix Visual Designer
http://www.phnxthunder.com