Dne 16.5.2017 v 17:33 Srinidhi B napsal(a):
> I recently found this:
> 
> https://github.com/yast/yast-registration/blob/master/src/lib/registration/ui/addon_reg_codes_dialog.rb#L148
>
> Hope this is what you are looking for.
> 


Yes, that's a good example of a dynamic dialog.

But keep in mind that the UI does NOT display a scroll bar when the widgets
do not fit into the dialog.

The Qt UI squeezes the widgets so they can even become unreadable, the ncurses 
UI
silently ignores them. That's pretty bad, some widgets might be missing
and users will not know about this issue.

If there is a high risk that the widgets will not fit into the dialog you should
experimentally find the maximum which fits and display an error if the current 
number
exceeds that limit.

See e.g.
https://github.com/yast/yast-registration/blob/master/src/lib/registration/ui/addon_selection_base_dialog.rb#L269

BTW the registration module tries to split the UI into two columns if one column
is not enough. This can help you to increase the limit of the maximum displayed
widgets at once.


Another solution is to use widgets which allow scrolling, e.g. Table, 
SelectionBox,
MultiSelectionBox, Tree. (Maybe there are more of them.)

See e.g. the repository manager ("yast2 repositories"), there is a scrollable 
table
with all repositories at the top. The widgets which modify the state
of the *selected* repository are displayed below the table.


The last possible solution is to use a RichText workaround. The RichText widget
allows scrolling, clicking the links return an user action just like button
presses and for check boxes and radio buttons you can use images.

But you need to implement all the logic for switching the widget states by
yourselves. E.g. ensure that only one radio button is selected.

See an example in the registration module:
  https://github.com/yast/yast-registration/pull/261

However, this approach also has some disadvantages, see more details in
  https://gist.github.com/lslezak/5ed82fe19337bef4807b#disadvantages

As this is really a workaround it should be used only when the previously 
mentioned
solutions fail because the displaying images instead of real buttons is a bit 
tricky
and does not reflect the definitions in the Qt stylesheet for the real widgets.

Also the installation stylesheet might be different than in the running system 
or in
the first boot mode. That might result in unreadable (black on black) text.
See the https://github.com/yast/yast-registration/pull/273 fix.


HTH

Ladislav

-- 
Ladislav Slezák
YaST Developer

SUSE LINUX, s.r.o.
Corso IIa
Křižíkova 148/34
18600 Praha 8
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to