UIHelpTool.st
changeset 151 8768bf518383
parent 148 785417b6955d
child 156 b332d7117c40
equal deleted inserted replaced
150:9f88bc99e0af 151:8768bf518383
    12     used by the UIPainter to add help text to any component which will be shown
    12     used by the UIPainter to add help text to any component which will be shown
    13     during runing an application with enabled activeHelp mode.
    13     during runing an application with enabled activeHelp mode.
    14 "
    14 "
    15 ! !
    15 ! !
    16 
    16 
       
    17 !UIHelpTool class methodsFor:'help specs'!
       
    18 
       
    19 helpSpec
       
    20     "return a dictionary filled with helpKey -> helptext associations.
       
    21      These are used by the activeHelp tool."
       
    22 
       
    23     |dict|
       
    24 
       
    25     dict := super helpSpec.
       
    26     dict at:#activeHelpAccessKey put:'This ID is used to access an active
       
    27 help text for the selected component'.
       
    28     ^ dict
       
    29 ! !
       
    30 
    17 !UIHelpTool class methodsFor:'interface specs'!
    31 !UIHelpTool class methodsFor:'interface specs'!
    18 
    32 
    19 windowSpec
    33 windowSpec
    20     "this window spec was automatically generated by the ST/X UIPainter"
    34     "this window spec was automatically generated by the ST/X UIPainter"
    21 
    35 
    22     "do not manually edit this - the painter/builder may not be able to
    36     "do not manually edit this - the painter/builder may not be able to
    23      handle the specification if its corrupted."
    37      handle the specification if its corrupted."
    24 
    38 
    25     "
    39     "
    26      UIPainter new openOnClass:ActiveHelpTool andSelector:#windowSpec
    40      UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec
    27      ActiveHelpTool new openInterface:#windowSpec
    41      UIHelpTool new openInterface:#windowSpec
    28     "
    42     "
    29     "ActiveHelpTool open"
    43     "UIHelpTool open"
    30 
    44 
    31     <resource: #canvas>
    45     <resource: #canvas>
    32 
    46 
    33     ^
    47     ^
    34      
    48      
    61                     #'resizeForLabel:' false
    75                     #'resizeForLabel:' false
    62                 )
    76                 )
    63                  #(#ComboBoxSpec
    77                  #(#ComboBoxSpec
    64                     #'name:' 'comboBox'
    78                     #'name:' 'comboBox'
    65                     #'layout:' #(#LayoutFrame 46 0 1 0 0 1.0 21 0)
    79                     #'layout:' #(#LayoutFrame 46 0 1 0 0 1.0 21 0)
       
    80                     #'activeHelpKey:' #activeHelpAccessKey
    66                     #'tabable:' true
    81                     #'tabable:' true
    67                     #'comboList:' #listChannel
    82                     #'comboList:' #listChannel
    68                 )
    83                 )
    69                  #(#LabelSpec
    84                  #(#LabelSpec
    70                     #'name:' 'textLabel'
    85                     #'name:' 'textLabel'
    78       )
    93       )
    79 ! !
    94 ! !
    80 
    95 
    81 !UIHelpTool methodsFor:'accessing'!
    96 !UIHelpTool methodsFor:'accessing'!
    82 
    97 
       
    98 dictionary
       
    99     "return the value of the instance variable 'dictionary' (automatically generated)"
       
   100 
       
   101     ^ dictionary!
       
   102 
       
   103 dictionary:aDictionary
       
   104     "set the value of the instance variable 'dictionary' (automatically generated)"
       
   105 
       
   106     (dictionary := aDictionary) notNil ifTrue:[
       
   107         list := dictionary keys asOrderedCollection
       
   108     ] ifFalse:[
       
   109         list := nil
       
   110     ].
       
   111 !
       
   112 
    83 key
   113 key
    84     "get the key from the edit field as symbol or nil
   114     "get the key from the edit field as symbol or nil
    85     "
   115     "
    86     |key|
   116     |key|
    87 
   117 
   104     ].
   134     ].
   105     (model := aKeyHolder) notNil ifTrue:[
   135     (model := aKeyHolder) notNil ifTrue:[
   106         model addDependent:self
   136         model addDependent:self
   107     ].
   137     ].
   108     (builder componentAt:#comboBox) model:model.
   138     (builder componentAt:#comboBox) model:model.
       
   139     self update:nil with:#model from:model.
   109 ! !
   140 ! !
   110 
   141 
   111 !UIHelpTool methodsFor:'actions'!
   142 !UIHelpTool methodsFor:'actions'!
   112 
   143 
   113 accept
   144 accept
   143 
   174 
   144     |holder|
   175     |holder|
   145 
   176 
   146     (holder := builder bindingAt:#listChannel) isNil ifTrue:[
   177     (holder := builder bindingAt:#listChannel) isNil ifTrue:[
   147         builder aspectAt:#listChannel put:(holder :=  ValueHolder new).
   178         builder aspectAt:#listChannel put:(holder :=  ValueHolder new).
       
   179         holder value:list
   148     ].
   180     ].
   149     ^ holder
   181     ^ holder
   150 !
   182 !
   151 
   183 
   152 textChannel
   184 textChannel