Layout example In Yab, you have the possiblity to use the layout command. I have write a little sub for me to generate the same look for the about view in my programs.
- In my program i define some variables.
- Then i take the screen width and height for fullscreen window or a little window and set it to the center of screen.
- After then i define a stackview for the rest of the program and set the frist stackview as shown
- With the About() i load the view About into the Stack, so i can get this view all the time from my menu (The control of menu and so on is here not shown)
- On the end of about view is a close button. This one must be all the time in the middle and follow the bottom and other widgets in the view. I expermented long time around to get the correct layout command to get the result.
-
- First in the sub i set the layout to all for the stackview
- then i get with current width and height from the stackview 5.3 after then i generate a view for the context.
- then i get with current width and height from the view for the context 5.5 After then i define some text.
- if you use texturl you must set the layout command to none, so the texturl has the same size, after then you must set the layout command to all, to get the same result from the other widgets.
- i put a readonly textedit to the view
- with LAYOUT "h-center,bottom", "View_About" i say that the following button is all time by resizing the window in the middle of the view and follows the windows With other compinations of layout option the button stays at the same position or by resizing to smaller windows the button go out of the windows. In some cases the button will be smaller or greater and that not the result i wanted.
ProgrammName$="ProgramName" Start_FensterName$="name_of_program" screenWidth = peek("desktopwidth") if (screenWidth=800) then sub About() LAYOUT "none", "View_About" TEXTURL 150,131, "email", " TEXTEDIT 10,220 TO view_about_x-5, view_about_y-150, "not_implemented", 1, "View_About" |