[Cuis-dev] The Preference model

ken.dickey at whidbey.com ken.dickey at whidbey.com
Fri Apr 29 06:36:59 PDT 2022


On 2022-04-28 19:45, Luciano Notarfrancesco via Cuis-dev wrote:

> We don't want to check a value is of the correct type before setting 
> it, we just want to specify the type so that a GUI tool for browsing 
> and editing preferences can build appropriate widgets for each 
> preference (a drop down list, a toggle button, etc). So the setter 
> thing doesn't make sense to me.

Ah!  You don't need a guard if you can guarantee the value is 
acceptable.

One thing I did with MetaProperties is, on mouse click of menu, to bring 
up either a simple fill-in / choice editor or a palette of choices.

In this case I used an #editProc to share the pop-up code. In this case, 
a Preference could have a #propClass (Type) accessor and the editProc 
would take the Property instance as an argument, then build the 
appropriate pop--up selection mechanism.

You can use the
   value := newValue.
   self class triggerEvent: #preferenceChanged with: self
to update the display menu (or whatever).

Pop-up editors/selectors are probably less trouble than making widgets 
part of a specialized Property Editor.  Just build a menu of {#propName, 
value} and "click it to change it".

In any case, have fun with this.  Thanks for letting me inject some 
random ideas.

Cheers,
-KenD


More information about the Cuis-dev mailing list