Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 5 Jahren
Letzter Beitrag:
vor 5 Jahren
Beteiligte Autoren:
Yogi Yang, Al, issah, Paulo Oliveira

How to achieve Elastic Layout?

Startbeitrag von Yogi Yang am 04.07.2013 12:31

As the subject suggests.

Currently what is happening is that if I hide a control in the window at run time then the place which the control occupies looks odd. :(

I would like to know if it is possible to design window layout in such a way that the controls placed in it are elastic in nature so if we hide a control then the adjoining control should automatically expand itself or move itself to occupy the invisible control's place.

Here is a screen shot of window with all controls visible in it.
[attachment 559 Ctrl_Visible.jpg]

Here is screen shot of window with the button set to be invisible at run time.
[attachment 560 Ctrl_Invisible.jpg]

Observe closely. The Edit control & button control has expanded themselves to occupy that space.

I have tied to find such a feature could not find so I would like to know if such a feature is available in WD or not?

If yes then how can I enable it?


Yogi Yang


Hello Yogi

And the product is Windev, Webdev, Winmobile ? and the version is ? :)

Aside from that, in Windev you can use the ..invisible state to tell you if the control is displayed or not. If it is not then you can use the width of the hidden control as the pixel value to expand the width of the other controls using the ..width function. You also need to store the original width of the controls so you can put them back if the other control is displayed again

I have this code in the onentry of a text control to make it larger when the cursor enters it
LNoteCtrlHeight = ClaimItemDescription..InitialHeight
LNoteCtrlWidth = ClaimItemDescription..InitialWidth
ClaimItemDescription..Height = LNoteCtrlHeight * 1.8

And this code in the focus loss of the control to restore it to normal
ClaimItemDescription..Height = LNoteCtrlHeight

The principle would be the same for you though


von Al - am 04.07.2013 12:54
The question is regarding WinDev.

The solution you suggest is quite lengthy and one will have to code this in all windows where this is required.

You see a small software that I am planning convert to WD is originally built in C++ and uses Qt for UI. Here this feature is built in.

I was wondering if such a feature would be available in WD.


Yogi Yang

von Yogi Yang - am 04.07.2013 14:03
Hello Yogi

Hopefully someone else has a better method, the one I mentioned is one I developed years ago.

You could build a couple of parameter driven procedures where you would only have to call the proc in the control events and pass the control names into it, but yes, it would still be tedious to add the procedure call in many control events.


von Al - am 04.07.2013 14:47
Hi Al,

Is there any method by which we can execute one single code for a particular event of all controls in current Window? Like for example I need to run a code whenever an Edit control gets focus by coding is once and getting WD to execute it for all Edit controls in current window.


Yogi Yang

von Yogi Yang - am 04.07.2013 15:01
To run one procedure for every control just check Event and Extern in the help.


von Paulo Oliveira - am 04.07.2013 15:34
Hello Yogi

You could construct a generic procedure to affect all the controls in a window by using one of the enumerate() functions to gather the control names, you might then need to test the names against a list of control names or types to know which ones to process, but I can't see how that could be triggered by a specific control getting focus unless there was also some code in the focus event of each control, which rather defeats the purpose, so i don't have much to offer unfortunately.

The FillAll() procedure in the GPWConfigurationDetails window of the pre v18 groupware window is an example of how to fill a table with all the controls of a window and how to segregate them by type..

Just spotted a ..FocusOnClick attribute that might offer some help if it was tested during a control enumerate loop but that probably would not have a value if the user tabbed into the control. There may be some other ..attributes for controls that may spark some ideas.


von Al - am 04.07.2013 15:43
Why don't you just right click on the control that you want to be elastic and choose 'anchor'. Choose the anchor type .......and voila.


von issah - am 04.07.2013 23:50
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.