How to change the position of the help popup in Delphi?

I have the code below which now displays a standard popup where available. Does anyone know if there is a positioning method where this window appears? For example, so that it appears where the user clicked?

function HelpPopupWindow(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean; var dwIDs: array[0..3] of DWord; begin dwIDs[0] := Handle; dwIDs[1] := Data; dwIDs[2] := 0; dwIDs[3] := 0; HtmlHelp(Handle, PChar('HELP FILE LOCATION HERE::/cshelp.txt'), HH_TP_HELP_CONTEXTMENU, DWORD(@dwIDs[0])); CallHelp := False; end; 

Greetings

Floor

+4
source share
1 answer

You can use HH_DISPLAY_TEXT_POPUP to display a popup. This gives you more flexibility through the HH_POPUP structure you are passing. Use the pt field to indicate the position:

Determines (in pixels) where the top center of the popup should be located.

The Helpware website provides sample Delphi code:

 {Show HH Popup using a string (StringID) from text file in a CHM StringID: eg. 99; CHMTextFile: eg. _runDir + 'help.chm::/cshelp.txt'} function HH_ShowPopupHelp3(aParent: TForm; StringID: Integer; CHMTextFile: String; XYPos: TPoint): HWND; var hhpopup: HH.THHPopup; begin with hhpopup do begin cbStruct := sizeof(hhpopup); //sizeof this structure hinst := 0; //no used idString := StringID; //topic number in a text file. pszText := nil; //no used pt := XYPos; //top center of popup clrForeground := COLORREF(-1); //use -1 for default - RGB value clrBackground := COLORREF(-1); //use -1 for default - RGB value rcMargins := Rect(-1,-1,-1,-1);//amount of space between edges pszFont := ''; end; Result := HtmlHelp(aParent.Handle, PChar(CHMTextFile), HH_DISPLAY_TEXT_POPUP, DWORD(@hhpopup)); end; 

In fact, I think you already found this page, judging by your code, but you just need to read a little further down the page.

+2
source

Source: https://habr.com/ru/post/1395750/


All Articles