Print
Parent Category: Development
Category: yab
Hits: 2107

Many times it try to use the LAYOUT command of yab, but i nerver get the result i want. The yab documentation (yab Commands) intruduce to add the layout command by the window widgte to take effect on the complete window, included the views and other widgets.

Excerpt from the yab documentation

LAYOUT Layout$, WindowOfView$

Set the layout for all views on the window of View$. The layout will affect all following new widgets, but not the already created. Draw commands are not affected by the layout, put them on an own view.

Layout$ (not case sensitive):

  • "Standard" = default layout, all widgets follow bottom and right side of the window except for listboxes and textedit which follow all sides.
  • "All" = follow all sides (widgets resize)
  • "None" = follow the top and the left side (equals "top, left")

-OR- Layout$ is a combination of a horizontal and a vertical command (e.g. "Right, Top" etc.).

Horizontal:

  • "Left" = follow left side (default, when no other horizontal layout is given)
  • "Right" = follow the right side
  • "Left, Right" = follow the left and the right side (resize)
  • "H-Center" = follow the horizontal center

Vertical:

  • "Top" = follow the top side (default, when no other vertical layout is given)
  • "Bottom" = follow the bottom side
  • "Top, Bottom" = follow the top and bottom side (resize)
  • "V-Center" = follow the vertical center


To the extent this is true also everything, but what if you want to leave certain things as they are and not others?

I then various settings in the layout command tested...

Results:


"Standard"

 


"All"

 


"None"

 


"Top, Bottom"

 


"Left, Bottom"

 


"Right, Top"



...but in the end it has not worked out so.

Here with me was always the point where I left out the LAYOUT command and I was looking for other ways to allow a change of the window.

Recently i tried it again for some time, even if it seemed to me illogical, i placed the Layout command in front of all widgets on the main window. In this case, I then realized that this works without problems and you can finally get the desired result so.



The most of the widgets (Buttons, Views...) follow the parameters automatically. Die meißten Module (Buttons, Views...) folgen automatisch dem festgelegten Parametern. However, a couple are not following this. The solution for this can be get from the yab documentation, because DRAW commands does not follow the layout commands, so you need to place them on separate views.

The same with the SPINCONTROL, place it on a separate view.


"Spincontrol"



Now i does not test every widget, but i think on this way you get every time a solution to fix it.


 

Translation by Christian Albrecht, Februar 2014
Tutorial by Christian Albrecht, Januar 2013
Made available by the BeSly, the Haiku knowledge base.