I have a dialog box that is giving users 3 options, yes, no , cancel ..
I change the yes , no to a new caption weapon1 and weapon 2. I also change the width of the buttons to match the width of the new caption. But if the new caption is too long , the buttons just over lap. How do i solve this?
Weapon1 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Attack1'];
Range1 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Range1'];
Weapon2 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Attack2'];
Range2 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Range2'];
with CreateMessageDialog('Please pick a weapon:', mtConfirmation, mbYesNoCancel) do
try
TButton(findcomponent('Yes')).Width := self.Canvas.TextWidth(' '+Weapon1+':'+range1+' ');
TButton(findcomponent('No')).Width := self.Canvas.TextWidth(' '+Weapon2+':'+range2+' ');
TButton(FindComponent('Yes')).Caption := Weapon1+':'+range1;
TButton(FindComponent('No')).Caption := Weapon2+':'+range2;
case ShowModal of
mrYes: AttackValue := '1';
mrNo: AttackValue := '2';
mrCancel: exit;
end;
finally
Free;
end;
insert this part of code
according to David Heffernan