View Issue Details

IDProjectCategoryView StatusLast Update
0032231LazarusLCLpublic2018-11-07 13:30
ReporterImants Gulbis Assigned ToOndrej Pokorny  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWin64OSWindows 
Product Version1.8RC3 
Summary0032231: TTaskDialog Do not work with radio buttons on Windows
DescriptionIt is impossible to check which radio-button is selected because "RadioButton" property is never set.
Steps To Reproducebegin
  if not dlgIcon.Execute then
    Exit;

  case dlgIcon.RadioButton.Index of
    0:;
    1:;
    2:;
  end
end;

dlgIcon.RadioButton.Index will always cause access violation because it is never set.
Additional InformationI checked Lazarus code and saw funny thing.

function TCustomTaskDialog.DoExecute(ParentWnd: HWND): Boolean;
...
begin
  ...
  ButtonID := TaskDlg.Execute(TD_COMMONBUTTONS(CommonButtons), DefBtn, TD_FLAGS(Flags), TF_DIALOGICON(MainIcon), TF_FOOTERICON(FooterIcon),
    DefRB, 0, ParentWnd, False, False, @DoOnButtonClickedHandler);
  Result := ButtonID>=0;
  FModalResult := ButtonIDToModalResult(ButtonID);

  if (TaskDlg.RadioRes>=0) and (TaskDlg.RadioRes<RadioButtons.Count) then
    FRadioButton := RadioButtons[TaskDlg.RadioRes] as TTaskDialogRadioButtonItem
  else
    FRadioButton := nil;
end;

And in Lcl TTaskDialog I saw this code

function TTaskDialog.Execute(...): integer;
...
begin
  ...
    RadioRes := 0;
    for i := 0 to high(Rad) do
      if Rad[i].Checked then
        RadioRes := i+200;
  ...
end;

If radiobutton is selected then RadioRes is always 200 or larger. So this "TaskDlg.RadioRes<RadioButtons.Count" will never be true and FRadioButton will always be nil
TagsNo tags attached.
Fixed in Revision55653
LazTarget-
Widgetset
Attached Files

Relationships

has duplicate 0032254 resolvedOndrej Pokorny TTaskDialog with radiobuttons always returns a nil RadioButton property 

Activities

Imants Gulbis

2017-08-01 08:12

reporter  

example.7z (60,508 bytes)

Ondrej Pokorny

2017-08-12 14:32

developer   ~0102145

I applied the patch by Howard Page-Clark.

Imants Gulbis

2018-11-07 13:29

reporter   ~0111827

-

Issue History

Date Modified Username Field Change
2017-08-01 08:12 Imants Gulbis New Issue
2017-08-01 08:12 Imants Gulbis File Added: example.7z
2017-08-05 14:54 Ondrej Pokorny Assigned To => Ondrej Pokorny
2017-08-05 14:54 Ondrej Pokorny Status new => assigned
2017-08-10 06:55 Ondrej Pokorny Relationship added related to 0032254
2017-08-12 14:31 Ondrej Pokorny Relationship replaced has duplicate 0032254
2017-08-12 14:32 Ondrej Pokorny Fixed in Revision => 55653
2017-08-12 14:32 Ondrej Pokorny LazTarget => -
2017-08-12 14:32 Ondrej Pokorny Note Added: 0102145
2017-08-12 14:32 Ondrej Pokorny Status assigned => resolved
2017-08-12 14:32 Ondrej Pokorny Resolution open => fixed
2018-11-07 13:29 Imants Gulbis Note Added: 0111827
2018-11-07 13:29 Imants Gulbis Status resolved => closed