eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ValueHolder':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ValueHolder


Inheritance:

   Object
   |
   +--Model
      |
      +--ValueModel
         |
         +--ValueHolder
            |
            +--BooleanValueHolder
            |
            +--BufferedValueHolder
            |
            +--RadioButtonGroup
            |
            +--RangeAdaptor
            |
            +--SelectionInList
            |
            +--TriggerValue
            |
            +--ValueHolderWithRememberedPreviousValue
            |
            +--ValueHolderWithWeakDependents

Package:
stx:libview2
Category:
Interface-Support-Models
Version:
rev: 1.27 date: 2023/06/10 07:39:20
user: cg
file: ValueHolder.st directory: libview2
module: stx stc-classLibrary: libview2

Description:


A valueHolder can be used as a model for editFields, buttons etc.
It stores some value internally, and sends update messages to its
dependents when changed.

Notice:
    this class was implemented using protocol information
    from alpha testers - it may not be complete or compatible to
    the corresponding ST-80 class.
    If you encounter any incompatibilities, please forward a note
    describing the incompatibility verbal (i.e. no code) to the ST/X team.

copyright

COPYRIGHT (c) 1995 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  newBoolean
return a new ValueHolder holding false as initial value

o  newFraction
return a new ValueHolder holding 0.0 as initial value.
The name is somewhat missleading - actually it should be called newFloat.

o  newNumber
return a new ValueHolder holding 0 as initial value

o  newString
return a new ValueHolder holding an empty string as initial value

o  newWithDependent: aDependent
(comment from inherited method)
ValueHolder newWithDependent:[self halt].

o  with: anObject
return a new ValueHolder holding anObject as initial value

o  with: anObject onChangeSend: selector to: stakeHolder
return a new ValueHolder holding anObject as initial value


Instance protocol:

accessing
o  setDependents: aCollectionOrDependentOrNil
private for initialization only

o  setValue: anObject
set my value without notification.

o  value
return my value

printing & storing
o  displayOn: aGCOrStream
Compatibility
append a printed desription on some stream (Dolphin, Squeak)
OR:
display the receiver in a graphicsContext at 0@0 (ST80).
This method allows for any object to be displayed in some view
(although the fallBack is to display its printString ...)

o  printOn: aStream
return a string for display in inspectors etc.


Examples:


See many examples in DialogBox & EditField edit strings:
    |firstName lastName dialog|

    firstName := ValueHolder newString.
    lastName := ValueHolder newString.

    dialog := Dialog new.
    (dialog addTextLabel:'Name:') adjust:#left.
    dialog addInputFieldOn:firstName.
    dialog addVerticalSpace.
    (dialog addTextLabel:'Address:') adjust:#left.
    dialog addInputFieldOn:lastName.

    dialog addAbortButton; addOkButton.

    dialog open.
    dialog accepted ifTrue:[
        Transcript show:firstName value; show:' '; showCR:lastName value
    ]


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 27 Jul 2024 03:58:04 GMT