mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-08 15:52:26 +01:00
Author:admin
Date:2010-11-02T16:24:15.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@693 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
BIN
documentation/current/solutions/_images/pref_dialog.png
Normal file
BIN
documentation/current/solutions/_images/pref_dialog.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
title=preference-window
|
||||||
|
author=admin
|
||||||
|
path=content/preference-window
|
||||||
@@ -5,7 +5,7 @@ This document describes the use of graphical widgets to display and manipulate p
|
|||||||
|
|
||||||
The preference library contains a cluster called <eiffel>interface</eiffel>. This cluster provides some basic classes which can be used to graphically display and manipulate the <eiffel>PREFERENCE</eiffel> types used by the library. There are various widget classes which correspond to particular types of preferences and can be used to view and change the values of an associated preference. The table below illustrates which widgets are used to display each of the known preference types:
|
The preference library contains a cluster called <eiffel>interface</eiffel>. This cluster provides some basic classes which can be used to graphically display and manipulate the <eiffel>PREFERENCE</eiffel> types used by the library. There are various widget classes which correspond to particular types of preferences and can be used to view and change the values of an associated preference. The table below illustrates which widgets are used to display each of the known preference types:
|
||||||
|
|
||||||
{|
|
{| border="1"
|
||||||
|-
|
|-
|
||||||
| '''Preference Type'''
|
| '''Preference Type'''
|
||||||
| '''Associated Widget'''
|
| '''Associated Widget'''
|
||||||
@@ -29,12 +29,24 @@ The preference library contains a cluster called <eiffel>interface</eiffel>. Thi
|
|||||||
| <eiffel>FONT_PREFERENCE_WIDGET</eiffel>
|
| <eiffel>FONT_PREFERENCE_WIDGET</eiffel>
|
||||||
|}
|
|}
|
||||||
|
|
||||||
All of these widgets inherit the abstract base class <eiffel>PREFERENCE_WIDGET</eiffel> and implement the required deferred features therein. Each implementation implements handling of an <eiffel>EV_GRID_ITEM</eiffel> widget from EiffelVision2 for use in the <eiffel>EV_GRID</eiffel> control, which allows for viewing and editing of the underlying preference value. For example, <eiffel>BOOLEAN_PREFERENCE_WIDGET</eiffel> uses an <eiffel>EV_GRID_COMBO_ITEM</eiffel> to display the 'True' and 'False' properties of a <eiffel>BOOLEAN_PREFERENCE</eiffel>. When the widget is loaded it displays the current value of the associated preference in the combo box. When the user changes the combo box value the preference value is changed also, and optionally saved.
|
|
||||||
Using these supplied widgets in your interface is simply a matter of creating the object and adding the <eiffel>change_item_widget</eiffel> to an instance of <eiffel>EV_GRID</eiffel>. By default the library provides such a view, in the form of <eiffel>PREFERENCES_WINDOW</eiffel>, which is a control that contains an <eiffel>EV_GRID</eiffel> and has all the necessary logic to handle graphical manipulation of the prefernce types provided in the library. This is an <eiffel>EV_TITLED_WINDOW</eiffel> with a navigable tree for finding groups of related preferences (i.e. managers), and a grid for displaying each preference. It is a useful, general purpose interface for preference manipulation. As with preferences themselves you may create your own custom view if this dialog is not sufficient for your needs, and can use the code therein as a template for your own code. Below is an image of the supplied window as it appears in the EiffelStudio preferences environment.
|
All of these widgets inherit the abstract base class <eiffel>PREFERENCE_WIDGET</eiffel> and implement the required deferred features therein. Each implementation implements handling of an <eiffel>EV_GRID_ITEM</eiffel> widget from EiffelVision2 for use in the <eiffel>EV_GRID</eiffel> control, which allows for viewing and editing of the underlying preference value. For example, <eiffel>BOOLEAN_PREFERENCE_WIDGET</eiffel> uses an <eiffel>EV_GRID_CHECKABLE_LABEL_ITEM</eiffel> to display the 'True' and 'False' properties of a <eiffel>BOOLEAN_PREFERENCE</eiffel>. Another example: <eiffel>CHOICE_PREFERENCE_WIDGET</eiffel> uses <eiffel>EV_GRID_CHOICE_ITEM</eiffel>, when the widget is loaded it displays the current value of the associated preference in the combo box. When the user changes the combo box value the preference value is changed also, and optionally saved.
|
||||||
|
|
||||||
|
Using these supplied widgets in your interface is simply a matter of creating the object and adding the <eiffel>change_item_widget</eiffel> to an instance of <eiffel>EV_GRID</eiffel>.
|
||||||
|
|
||||||
|
By default the library provides such a view, in the form of <eiffel>PREFERENCES_GRID_CONTROL</eiffel>, and for easier usage <eiffel>PREFERENCES_GRID_DIALOG</eiffel>, which is a dialog control that contains a grid <eiffel>PREFERENCES_GRID_CONTROL</eiffel> and has all the necessary logic to handle graphical manipulation of the preference types provided in the library.
|
||||||
|
|
||||||
|
The <eiffel>PREFERENCES_GRID_DIALOG</eiffel> is a <eiffel>EV_DIALOG</eiffel> with a navigable tree/grid for finding groups of related preferences (i.e. managers), and the various preferences as a row. It is a useful, general purpose interface for preference manipulation.
|
||||||
|
|
||||||
|
You have the possibility to view the preferences as a ''tree'', or a ''flat view''. In this ''flat view'', you can filter the preferences to find easily a preference.
|
||||||
|
|
||||||
|
As with preferences themselves you may create your own custom view if this dialog is not sufficient for your needs, and can use the code therein as a template for your own code. You can also use the <eiffel>PREFERENCES_GRID_CONTROL</eiffel> to embed the preferences grid control in your application interface.
|
||||||
|
|
||||||
|
Below is an image of the supplied window as it appears in the EiffelStudio preferences environment.
|
||||||
|
|
||||||
[[Image:preference-window]]
|
[[Image:preference-window]]
|
||||||
|
|
||||||
For an example of creating custom widget views for individual preferences, or a custom view for all preferences, please refer to the example in this documentation.
|
For an example of creating custom widget views for individual preferences, or a custom view for all preferences, please refer to the [[EiffelPreferences Sample|example]] in this documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user