Link to home
Start Free TrialLog in
Avatar of ST3VO
ST3VOFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Position button to the right (like alRight)

Hi all,

I am having a problem trying to set the position of a button to be at the right.

I'm tried:

Button.Left := PageControl1.Width - Button.Width;

but it's not on the far right but about an inch from the far right.

I cannot use Align:=AlRight because the button goes to the right BUT it expands to the height of the form too so...what can I do please?

thx

st3vo
ASKER CERTIFIED SOLUTION
Avatar of CodedK
CodedK
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ST3VO

ASKER

Hmm...It's kind of worked now BUT I have no longer control on the button width.

The button is now quite big in width and I cannot change it anymore.

See code below...width is not working anymore, eventhough it's specified.

thx


Button.Anchors := [akLeft, akBottom, akRight];
Button.Width:= 22;
Button.Left := sPageControl1.Width + Button.Width;
Button.Caption:=('X');

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
change all anchors to false one by one and then set the width.
See which anchor gives you the problem.
Probably you need to set the anchor of right to false (set by default to true i thing).
Try it and post back.
Avatar of FactorB
FactorB

Sorry, change

Button1.Caption:=('X');
to
Button1.Caption:='X';
Avatar of ST3VO

ASKER

OK, I've tried all of them and none work 100%.

I'm not going to try: CodedK's change all anchors to false one by one and then set the width BUT the Button is created at runtime, so what's the syntax to set them to false?

Maybe like this.....

Button1.Anchors := [akLeft, akBottom, akRight];

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ST3VO

ASKER

Thanks all ! It wasn't just one thing that made it work ... it was a bit of all put together :o)