Recent

Author Topic: Anchoring to invisible Controls  (Read 1210 times)

Weitentaaal

  • Hero Member
  • *****
  • Posts: 554
Anchoring to invisible Controls
« on: February 14, 2024, 08:13:01 am »
Hello,

would someone please help me out here. i try to anchor 2 Buttons but there is a case where one of them gets invisible (See Pictures). So Button21 is anchored to the border of the form with a space of 8. the second Button(button 22) is anchored to button21 with a space of 2. When Button21 is set to be invisible, then the Button22 will skip Button21 and dock to the form border. The problem i have is that the Space to the Border now is 2 and not  8. is there any easy fix for that or do i need to set border spacing manually ?

thanks in advance.

jamie

  • Hero Member
  • *****
  • Posts: 6953
Re: Anchoring to invisible Controls
« Reply #1 on: February 15, 2024, 12:42:18 am »
You need to manually edit the values are runtime.
The only true wisdom is knowing you know nothing

dseligo

  • Hero Member
  • *****
  • Posts: 1522
Re: Anchoring to invisible Controls
« Reply #2 on: February 15, 2024, 01:31:10 am »
If you want to do it visually, you could put a panel with width 6 anchored to form (set bevel to none and delete caption).
Now anchor Button21 to panel and Button22 to Button21.
Set border space of both buttons to 2.

Weitentaaal

  • Hero Member
  • *****
  • Posts: 554
Re: Anchoring to invisible Controls
« Reply #3 on: February 15, 2024, 07:34:24 am »
ok thanks for the Tips !

Joanna

  • Hero Member
  • *****
  • Posts: 1429
Re: Anchoring to invisible Controls
« Reply #4 on: February 15, 2024, 02:06:55 pm »
Call this code when visibility of button21 changes

Button22.borderspacing.right:= 2+ (6*ord(not button21.visible));
« Last Edit: February 15, 2024, 02:08:39 pm by Joanna »
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

 

TinyPortal © 2005-2018