View Single Post
  #11  
Old 20-08-2025, 03:35
PHM2D's Avatar
PHM2D PHM2D is offline
Registered User
 
Join Date: Mar 2024
Location: Area 51
Posts: 9
Thanks: 6
Thanked 5 Times in 3 Posts
PHM2D is on a distinguished road
Start Menu Shortcut Bugs!

When I checked the start menu shortcut creator checkbox, I realized that the shortcut is not created inside the programs folder of the start menu. However it was created when I checked the desktop shortcut creator checkbox. So I fixed it like this:
Code:
//#if !CompactMode || !UpdateMode
//  function CreateIconsDesktop: Boolean;
//  begin
//    Result := (not IsDoneError) and IconsCB.Checked;
//  end;

//  function IsUninstallable: Boolean;
//  begin
//    Result := UninstallCB.Checked;
//  end;
//#endif

//#if !CompactMode
//function CreateIconsStartMenu: Boolean;
//begin
//  Result := (not IsDoneError) and (not StartMenuCB.Checked);
//end;
//#endif

function CreateIconsDesktop: Boolean;
begin
  Result := (not IsDoneError) and Assigned(IconsCB) and IconsCB.Checked;  // your “desktop shortcut” checkbox
end;

function CreateIconsStartMenu: Boolean;
begin
  Result := (not IsDoneError) and Assigned(StartMenuCB) and StartMenuCB.Checked;
end;

function IsUninstallable: Boolean;
begin
  Result := Assigned(UninstallCB) and UninstallCB.Checked;
end;

procedure StartMenuCBClick(Sender: TObject);
var
  CB: TNewCheckBox;
begin
  if (Sender is TNewCheckBox) then CB := TNewCheckBox(Sender) else CB := StartMenuCB;
  if Assigned(WizardForm) and Assigned(CB) then
  begin
    WizardForm.GroupEdit.Enabled := CB.Checked;
    WizardForm.GroupBrowseButton.Enabled := CB.Checked;
  end;
end;
Then called it inside the
Code:
StartMenuCB := TNewCheckBox.Create(WizardForm);
like this:
Code:
      Checked  := False;             // 1) set default state
      OnClick  := @StartMenuCBClick; // 2) wire the handler
      StartMenuCBClick(StartMenuCB); // 3) Synchronize the UI to the current checkbox state
    end;
I don't know if anyone has experienced this bug but here is my solution nevertheless!
__________________
Built with hustle, crowned with success.
Reply With Quote