View Issue Details

IDProjectCategoryView StatusLast Update
0015065LazarusLCLpublic2010-11-20 16:13
ReporterKon GolovatzkiyAssigned ToPaul Ishenin 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target Version1.0.0Fixed in Version0.9.29 (SVN) 
Summary0015065: TWinControl.HelpContext properties are not applied to Windows
DescriptionSVN revision 22358.
OS-Windows.
In main loop on message WM_HELP we always receive zero in
LPHELPINFO(LParam)^.dwContextId regardless we set HelpContext properties of all controls on the form.

Somewhere in Win32/64 LCL code there should be API calls SetWindowContextHelpId() and SetMenuContextHelpID() so Windows will know how to fill LPHELPINFO(LParam).

I had to enumerate all TWinControl descendants and apply these API functions in FormCreate event to make help working. :(
Additional InformationTo test the issue we can define
  Application.OnHelp:=MyHLP;{Application.OnHelp is called on WM_HELP}

where MyHLP is like this:

function TMyHLP.MyHLP(Command: Word; Data: PtrInt; var CallHelp: Boolean): Boolean;
var _pHelpInfo: LPHELPINFO;
begin
  if Data<>0 then begin
      _pHelpInfo:=LPHELPINFO(Data);
    if _pHelpInfo<>nil then begin

      // here we always receive _pHelpInfo^.dwContextId=0
      //..some code goes here....

      CallHelp:=False;
    end;
  end;
  Result:=True;
end;
TagsNo tags attached.
Fixed in Revision26744
LazTarget1.0
WidgetsetWin32/Win64
Attached Files

Activities

2009-11-24 06:49

 

helpcontext_exam.zip (163,075 bytes)

Kon Golovatzkiy

2009-11-24 06:50

reporter   ~0032415

Last edited: 2009-11-24 06:51

I've added an example tested with SVN revision 22727.

Graeme Geldenhuys

2009-11-24 07:39

reporter   ~0032417

At the same time, I think the OnHelp event signature should be changed too..

TTHelpEvent = function(AHelpType: THelpType; AHelpContext: THelpContext;
       const AHelpKeyword: String; const AHelpFile: String;
       var AHandled: Boolean): Boolean of object;

This make a lot more sense than the WinHelp (Windows) specific help format signature. The RTL already contains THelpType, THelpContext so why not use them in the event signature too?

Kon Golovatzkiy

2009-11-24 11:20

reporter   ~0032424

Changing an existent type will break a lot of working code and, of course, Delphi compatibility.
For cross-platform help a THelpManager descendant may be used, I think.

Paul Ishenin

2010-07-20 10:45

manager   ~0039483

I've changed the OnHelp Data to be compatible with delphi. Now you can change your function in the following way:


function TForm1.MyHLP(Command: Word; Data: PtrInt; var CallHelp: Boolean): Boolean;
begin
  case Command of
    1: ShowMessage('ContextId = ' + IntToStr(Data));
    258: ShowMessage('Keyword = ' + String(PChar(Data)));
  end;
  Result:=True;
end;

Please test and close if ok.

Issue History

Date Modified Username Field Change
2009-11-11 22:57 Kon Golovatzkiy New Issue
2009-11-11 22:57 Kon Golovatzkiy Widgetset => Win32/Win64
2009-11-18 23:14 Vincent Snijders LazTarget => 1.0
2009-11-18 23:14 Vincent Snijders Status new => acknowledged
2009-11-18 23:14 Vincent Snijders Target Version => 1.0.0
2009-11-24 06:49 Kon Golovatzkiy File Added: helpcontext_exam.zip
2009-11-24 06:50 Kon Golovatzkiy Note Added: 0032415
2009-11-24 06:51 Kon Golovatzkiy Note Edited: 0032415
2009-11-24 07:39 Graeme Geldenhuys Note Added: 0032417
2009-11-24 11:20 Kon Golovatzkiy Note Added: 0032424
2010-07-20 10:45 Paul Ishenin Fixed in Revision => 26744
2010-07-20 10:45 Paul Ishenin Status acknowledged => resolved
2010-07-20 10:45 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2010-07-20 10:45 Paul Ishenin Resolution open => fixed
2010-07-20 10:45 Paul Ishenin Assigned To => Paul Ishenin
2010-07-20 10:45 Paul Ishenin Note Added: 0039483
2010-11-20 16:13 Kon Golovatzkiy Status resolved => closed