02-08-2023, 02:21 PM
Hello!
Try this:
Put an TIWRegion on a form (greater than 100, 100)
Put a TWButton in the Region
Set the Button.Align to alClient
Set the Button.Margins to 20,20,20,20
All this works fine, the button fills the entire region.
If you now add an event to the Button as:
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
IWButton1.AlignWithMargins := Not IWButton1.AlignWithMargins;
end;
The AlignWithMargins will toggle when clicking the button, but the top and left positions are not set to 0 when AlignWithMargins is set to False and scrollbars appear in then Region control.
I tried the same function but in the Button1.OnClick event and then it works!? When AlignWithMargins is set to False the Button is reset to its original position filling the entire Region.
Is this a bug or as it should be? Maybee It's my lack of understanding of the Asynch and Synch events
Whats the difference between Asynch and Synch events and when should they be used?
Best asynch regards, Mikael
Try this:
Put an TIWRegion on a form (greater than 100, 100)
Put a TWButton in the Region
Set the Button.Align to alClient
Set the Button.Margins to 20,20,20,20
All this works fine, the button fills the entire region.
If you now add an event to the Button as:
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
IWButton1.AlignWithMargins := Not IWButton1.AlignWithMargins;
end;
The AlignWithMargins will toggle when clicking the button, but the top and left positions are not set to 0 when AlignWithMargins is set to False and scrollbars appear in then Region control.
I tried the same function but in the Button1.OnClick event and then it works!? When AlignWithMargins is set to False the Button is reset to its original position filling the entire Region.
Is this a bug or as it should be? Maybee It's my lack of understanding of the Asynch and Synch events

Whats the difference between Asynch and Synch events and when should they be used?
Best asynch regards, Mikael