ActiveHelp.st
author Claus Gittinger <cg@exept.de>
Tue, 13 Apr 1999 16:02:21 +0200
changeset 1158 fe67c8fdf68b
parent 1143 5706310407e9
child 1212 816bee31f949
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     1
"
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     4
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    11
"
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    12
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    13
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    14
EventListener subclass:#ActiveHelp
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
    15
	instanceVariableNames:'currentView currentHelpView currentFrame showProcess closeProcess
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    16
		lastHelpText listeningForAll applicationsOrTopViewsWithHelp'
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    17
	classVariableNames:'DelayTime ShowTime TheOneAndOnlyHelpListener'
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    18
	poolDictionaries:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    19
	category:'Interface-Help'
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    20
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    21
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    22
!ActiveHelp class methodsFor:'documentation'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    23
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    24
copyright
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    25
"
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    27
	      All Rights Reserved
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    28
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    29
 This software is furnished under a license and may be used
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    30
 only in accordance with the terms of that license and with the
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    32
 be provided or otherwise made available to, or used by, any
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    33
 other person.  No title to or ownership of the software is
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    34
 hereby transferred.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    35
"
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    36
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    37
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    38
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    39
documentation
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    40
"
98
claus
parents: 97
diff changeset
    41
    The active help listener.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    42
98
claus
parents: 97
diff changeset
    43
    The one and only instance of myself intercepts incoming mouse & keyboard 
claus
parents: 97
diff changeset
    44
    events for the display device, being especially interested in view-enter/
636
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    45
    leave events. When such an event arrives, it asks the corresponding view
98
claus
parents: 97
diff changeset
    46
    or its model for a help message and display it via an ActiveHelpView.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    47
    (actually, the view is first asked if it would like to display it itself
636
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    48
     - for example, in some information-view).
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    49
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    50
    The query for the helpText is repeated along the views superView chain, 
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    51
    until any model or view returns a nonNil answer for the #helpTextFor:at 
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    52
    or #helpTextFor message.
100
claus
parents: 98
diff changeset
    53
98
claus
parents: 97
diff changeset
    54
    All I need for automatic help is some model/view/applicationModel along
claus
parents: 97
diff changeset
    55
    the superview chain of the entered component, which responds to the
claus
parents: 97
diff changeset
    56
    #helpTextFor: message with a non-nil (string-) answer.
claus
parents: 97
diff changeset
    57
    I close down the help view after a while, if a key is pressed or the mouse
claus
parents: 97
diff changeset
    58
    moved to another view.
100
claus
parents: 98
diff changeset
    59
claus
parents: 98
diff changeset
    60
    Who should provide the helpText:
claus
parents: 98
diff changeset
    61
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    62
        the best place is the application object (an instance of ApplicationModel)
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    63
        or the topView, if its a derived class of StandardSystemView.
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    64
        This should know about its components and return the string
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    65
        when asked via #helpTextFor:aComponent.
330
d7ce98930ad3 Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents: 297
diff changeset
    66
        See examples in FileBrowser, Launcher etc.
100
claus
parents: 98
diff changeset
    67
claus
parents: 98
diff changeset
    68
    Be aware, that for applicationModels, there must be a link from the
claus
parents: 98
diff changeset
    69
    topView to this applicationModel 
claus
parents: 98
diff changeset
    70
    (set via: aTopView application:anApplicationModel)
claus
parents: 98
diff changeset
    71
    otherwise, the helpManager has no means of finding the application which
claus
parents: 98
diff changeset
    72
    corresponds to a view.
claus
parents: 98
diff changeset
    73
claus
parents: 98
diff changeset
    74
    Who should display the helpText:
claus
parents: 98
diff changeset
    75
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    76
        by default, the helpListener opens a little popup view, which displays the
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    77
        returned help message. However, a nice trick which can be used by applications
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    78
        is to create an infoLabel as a subview of the topFrame (a la windows)
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    79
        and display the text right in the #helpTextFor: method. To cheat the
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    80
        help listener, this method should then return nil, to keep it silent.
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    81
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    82
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    83
    Usage:
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    84
        If help is to be shown for all views (as enabled by the launchers help menu),
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    85
        use 'ActiveHelp start' and 'ActiveHelp stop'.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    86
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    87
        Individual apps may enable/disable active help for themself by:
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    88
        'ActiveHelp startFor:app' or 'ActiveHelp stopFor:app', passing either
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    89
        the topView or the topViews application as argument.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    90
        This is usually done by applications which want to show contextHelp in
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    91
        some infoView.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    92
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    93
        
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    94
    [author:]
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    95
        Claus Gittinger
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    96
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
    97
    [start with:]
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
    98
        ActiveHelp start
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
    99
        ActiveHelp stop
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   100
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   101
    [See also:]
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   102
        ActiveHelpView
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   103
        WindowGroup WindowEvent
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   104
        ApplicationModel StandardSystemView
100
claus
parents: 98
diff changeset
   105
"
claus
parents: 98
diff changeset
   106
!
claus
parents: 98
diff changeset
   107
claus
parents: 98
diff changeset
   108
examples
claus
parents: 98
diff changeset
   109
"
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   110
  Active Help for a single view
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   111
  or app (whatever the global settings are):
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   112
  Can be initiated by an app when its opened.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   113
                                                                        [exBegin]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   114
        |app top myAppClass|
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   115
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   116
        Class withoutUpdatingChangesDo:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   117
            myAppClass := ApplicationModel 
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   118
                            subclass:#'Demos::DemoApp'
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   119
                            instanceVariableNames:''
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   120
                            classVariableNames:''
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   121
                            poolDictionaries:''
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   122
                            category:'demos'.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   123
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   124
            myAppClass 
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   125
                compile:'helpTextFor:aView    Transcript showCR:''hello''. ^ ''this is some helpText'''.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   126
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   127
        ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   128
        app := myAppClass new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   129
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   130
        top := StandardSystemView new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   131
        top extent:300@100.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   132
        top application:app.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   133
        top open.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   134
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   135
        ActiveHelp startFor:app.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   136
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   137
        Class withoutUpdatingChangesDo:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   138
            myAppClass removeFromSystem
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   139
        ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   140
                                                                        [exEnd]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   141
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   142
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   143
  Active Help (for all views):
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   144
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   145
    (make certain that activeHelp is turned on ...
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   146
     ... otherwise, you will see nothing)
100
claus
parents: 98
diff changeset
   147
claus
parents: 98
diff changeset
   148
    the following example uses a Plug as a model replacement.
claus
parents: 98
diff changeset
   149
    In concrete application, you would create a method to implement the helpText
claus
parents: 98
diff changeset
   150
    query message.
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   151
                                                                        [exBegin]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   152
        |app top button1 button2|
100
claus
parents: 98
diff changeset
   153
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   154
        app := Plug new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   155
        app respondTo:#helpTextFor:
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   156
                 with:[:view | 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   157
                               view == button1 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   158
                                 'this is button1'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   159
                               ] ifFalse:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   160
                                 view == button2 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   161
                                   'some help for button2'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   162
                                 ] ifFalse:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   163
                                   nil
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   164
                                 ]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   165
                               ]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   166
                      ].
100
claus
parents: 98
diff changeset
   167
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   168
        top := StandardSystemView new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   169
        top extent:300@100.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   170
        button1 := Button label:'b1' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   171
        button1 origin:0.0@0.0 corner:0.5@30. 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   172
        button2 := Button label:'b2' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   173
        button2 origin:0.5@0.0 corner:1.0@30.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   174
        top model:app. '<-- normally this would be: top application:app'.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   175
        top open
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   176
                                                                        [exEnd]
100
claus
parents: 98
diff changeset
   177
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   178
    (make certain that activeHelp is turned on ...
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   179
     ... otherwise, you will see nothing)
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   180
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   181
    alternatively, display of the helpMessage in a local, private view:
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   182
                                                                        [exBegin]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   183
        |app top button1 button2 infoView|
100
claus
parents: 98
diff changeset
   184
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   185
        app := Plug new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   186
        app respondTo:#helpTextFor:
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   187
                 with:[:view | infoView label:'info ...'.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   188
                               view == button1 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   189
                                 infoView label:'this is button1'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   190
                               ].
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   191
                               view == button2 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   192
                                 infoView label:'some help for button2'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   193
                               ].
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   194
                               nil
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   195
                      ].
100
claus
parents: 98
diff changeset
   196
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   197
        top := StandardSystemView new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   198
        top extent:300@100.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   199
        button1 := Button label:'b1' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   200
        button1 origin:0.0@0.0 corner:0.5@30. 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   201
        button2 := Button label:'b2' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   202
        button2 origin:0.5@0.0 corner:1.0@30.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   203
        infoView := Label label:'info ...' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   204
        infoView level:-1; origin:0.0@1.0 corner:1.0@1.0.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   205
        infoView topInset:(infoView preferredExtent y negated - 3);
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   206
                 leftInset:3; 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   207
                 rightInset:3; 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   208
                 bottomInset:3;
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   209
                 adjust:#left.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   210
        top model:app. '<-- normally this would be: top application:app'.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   211
        top open
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   212
                                                                        [exEnd]
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   213
"
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   214
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   215
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   216
!ActiveHelp class methodsFor:'initialization'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   217
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   218
initialize
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   219
    "set default delay & help-display times"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   220
92
claus
parents: 59
diff changeset
   221
    ShowTime := 15.
100
claus
parents: 98
diff changeset
   222
    DelayTime := 2.
92
claus
parents: 59
diff changeset
   223
claus
parents: 59
diff changeset
   224
    "
claus
parents: 59
diff changeset
   225
     ActiveHelp initialize
claus
parents: 59
diff changeset
   226
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   227
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   228
    "Modified: 27.4.1996 / 15:07:27 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   229
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   230
633
5d162347fac8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   231
!ActiveHelp class methodsFor:'queries'!
100
claus
parents: 98
diff changeset
   232
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   233
currentHelpListener
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   234
    "return the activeHelp listener if activeHelp is turned on, nil otherwise"
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   235
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   236
    ^ TheOneAndOnlyHelpListener
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   237
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   238
    "Created: 28.6.1997 / 13:59:44 / cg"
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   239
!
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   240
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   241
isActive
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   242
    "return true, if activeHelp is turned on"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   243
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   244
    ^ TheOneAndOnlyHelpListener notNil
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   245
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   246
    "Modified: 27.4.1996 / 15:07:57 / cg"
633
5d162347fac8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   247
! !
5d162347fac8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   248
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   249
!ActiveHelp class methodsFor:'start & stop'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   250
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   251
start
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   252
    "start activeHelp for all apps"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   253
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   254
    TheOneAndOnlyHelpListener isNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   255
        TheOneAndOnlyHelpListener := self new.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   256
    ].
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   257
    TheOneAndOnlyHelpListener listenForAll
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   258
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   259
    "
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   260
     ActiveHelp start
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   261
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   262
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   263
    "Modified: / 26.10.1997 / 23:16:54 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   264
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   265
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   266
startFor:anApplicationOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   267
    "start activeHelp for a single app"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   268
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   269
    TheOneAndOnlyHelpListener isNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   270
        TheOneAndOnlyHelpListener := self new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   271
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   272
    TheOneAndOnlyHelpListener listenFor:anApplicationOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   273
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   274
    "Modified: / 26.10.1997 / 23:17:05 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   275
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   276
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   277
stop
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   278
    "stop activeHelp for all (except for individual apps)"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   279
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   280
    TheOneAndOnlyHelpListener notNil ifTrue:[
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   281
        TheOneAndOnlyHelpListener unlistenAll.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   282
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   283
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   284
    "
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   285
     ActiveHelp stop
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   286
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   287
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   288
    "Modified: / 26.10.1997 / 23:18:58 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   289
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   290
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   291
stopFor:anAppOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   292
    "stop activeHelp for a single app"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   293
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   294
    TheOneAndOnlyHelpListener notNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   295
        TheOneAndOnlyHelpListener unlistenFor:anAppOrTopView.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   296
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   297
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   298
    "Modified: / 26.10.1997 / 23:12:55 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   299
    "Created: / 26.10.1997 / 23:18:41 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   300
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   301
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   302
!ActiveHelp class methodsFor:'times'!
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   303
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   304
delayTime:numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   305
    "set the delay (the time, the cursor has to be in the view
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   306
     before help is shown). The default is 2 seconds."
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   307
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   308
    DelayTime := numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   309
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   310
    "
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   311
     ActiveHelp delayTime:0.5
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   312
     ActiveHelp delayTime:2
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   313
     ActiveHelp delayTime:10
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   314
    "
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   315
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   316
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   317
showTime:numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   318
    "set the number of seconds, a help messages is to be shown.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   319
     The default is 15 seconds."
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   320
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   321
    ShowTime := numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   322
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   323
    "
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   324
     ActiveHelp showTime:10
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   325
     ActiveHelp showTime:99999 
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   326
     ActiveHelp showTime:30
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   327
    "
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   328
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   329
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   330
!ActiveHelp methodsFor:'listening'!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   331
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   332
buttonMotion:state x:x y:y view:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   333
    "handle motion events - if the mousepointer left the 
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   334
     previous helped view, hide the help"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   335
1048
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   336
    Object errorSignal handle:[:ex |
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   337
        ex return
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   338
    ] do:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   339
        "/ ignore my own help-view
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   340
        aView topView == currentHelpView ifTrue:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   341
           ^ true
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   342
        ].
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   343
1048
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   344
        (self interestedIn:aView) ifTrue:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   345
            self stopHelpDisplayProcess.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   346
            self hideIfPointerLeft:aView.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   347
            self initiateHelpFor:aView atX:x y:y.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   348
        ].
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   349
    ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   350
    ^ false
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   351
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   352
    "Modified: / 28.7.1998 / 02:51:51 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   353
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   354
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   355
buttonPress:state x:x y:y view:view
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   356
    "handle button press - unconditionally hide the help"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   357
1048
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   358
    Object errorSignal handle:[:ex |
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   359
        ex return
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   360
    ] do:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   361
        self hideHelp.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   362
    ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   363
    ^ false
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   364
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   365
    "Modified: / 28.7.1998 / 02:52:00 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   366
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   367
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   368
keyPress:state x:x y:y view:view
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   369
    "handle key press - unconditionally hide the help"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   370
1048
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   371
    Object errorSignal handle:[:ex |
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   372
        ex return
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   373
    ] do:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   374
        self hideHelp.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   375
    ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   376
    ^ false
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   377
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   378
    "Modified: 27.4.1996 / 15:09:57 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   379
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   380
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   381
pointerEnter:state x:x y:y view:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   382
    "handle pointer entering a view; setup timeOut to show help"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   383
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   384
    "/ ignore my own help-view
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   385
    aView topView == currentHelpView ifTrue:[
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   386
       ^ true
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   387
    ].
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   388
1048
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   389
    Object errorSignal handle:[:ex |
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   390
        ex return
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   391
    ] do:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   392
        (self interestedIn:aView) ifTrue:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   393
            self stopHelpDisplayProcess.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   394
            self hideIfPointerLeft:aView.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   395
            self initiateHelpFor:aView atX:x y:y.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   396
        ].
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   397
    ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   398
    ^ false
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   399
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   400
    "Modified: / 28.7.1998 / 02:52:09 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   401
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   402
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   403
pointerLeave:state view:view
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   404
    "handle pointer leaving a view; hide help text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   405
1048
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   406
    Object errorSignal handle:[:ex |
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   407
        ex return
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   408
    ] do:[
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   409
        self hideIfPointerLeft:view.
84719be68422 catch error while doing active help - since this is done
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
   410
    ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   411
    ^ false
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   412
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   413
    "Modified: / 28.7.1998 / 02:52:16 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   414
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   415
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   416
!ActiveHelp methodsFor:'private'!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   417
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   418
helpTextFor:aView atX:x y:y
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   419
    "retrieve helptext for aView as a string; 
100
claus
parents: 98
diff changeset
   420
     walk along the views superView chain,
claus
parents: 98
diff changeset
   421
     asking models and views encountered while walking.
claus
parents: 98
diff changeset
   422
     The first one who understands and returns a nonNil answer to the
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   423
     #helpTextFor:at: or #helpTextFor: message ends this search and the
100
claus
parents: 98
diff changeset
   424
     returned string is returned."
claus
parents: 98
diff changeset
   425
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   426
    |model app text view v sv p|
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   427
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   428
    view := aView.
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   429
    p := x @ y.
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   430
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   431
    (model := aView model) notNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   432
        (model respondsTo:#helpTextFor:at:) ifTrue:[
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   433
            text := model helpTextFor:aView at:p.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   434
            text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   435
        ].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   436
        (model respondsTo:#helpTextFor:) ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   437
            text := model helpTextFor:aView.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   438
            text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   439
        ]
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   440
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   441
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   442
    (aView respondsTo:#helpTextAt:) ifTrue:[
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   443
        text := aView helpTextAt:p.
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   444
        text notNil ifTrue:[^ text].
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   445
    ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   446
    (aView respondsTo:#helpText) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   447
        text := aView helpText.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   448
        text notNil ifTrue:[^ text].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   449
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   450
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   451
    "walk up the chain - maybe someone knows about its subview ..."
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   452
    v := aView.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   453
296
c7ae52588794 #superView -> #container
Claus Gittinger <cg@exept.de>
parents: 276
diff changeset
   454
    [(sv := v container) notNil] whileTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   455
        (model := sv model) notNil ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   456
            (model respondsTo:#helpTextFor:at:) ifTrue:[
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   457
                text := model helpTextFor:aView at:p.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   458
                text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   459
            ].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   460
            (model respondsTo:#helpTextFor:) ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   461
                text := model helpTextFor:aView.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   462
                text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   463
            ]
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   464
        ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   465
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   466
        (sv respondsTo:#helpTextFor:) ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   467
            text := sv helpTextFor:aView.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   468
            text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   469
            text := sv helpTextFor:v.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   470
            text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   471
         ].
602
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   472
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   473
         v := sv.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   474
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   475
602
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   476
    (aView respondsTo:#application) ifTrue:[
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   477
        (app := aView application) notNil ifTrue:[
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   478
            (app respondsTo:#helpTextFor:at:) ifTrue:[
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   479
                text := app helpTextFor:aView at:p.
602
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   480
                text notNil ifTrue:[^ text].
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   481
            ].
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   482
            (app respondsTo:#helpTextFor:) ifTrue:[
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   483
                text := app helpTextFor:aView.
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   484
                text notNil ifTrue:[^ text].
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   485
            ]
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   486
        ]
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   487
    ].
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   488
100
claus
parents: 98
diff changeset
   489
    (v notNil and:[v respondsTo:#application]) ifTrue:[
602
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   490
        (app := v application) notNil ifTrue:[
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   491
            (app respondsTo:#helpTextFor:at:) ifTrue:[
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   492
                text := app helpTextFor:aView at:p.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   493
                text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   494
            ].
602
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   495
            (app respondsTo:#helpTextFor:) ifTrue:[
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   496
                text := app helpTextFor:aView.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   497
                text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   498
            ]
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   499
        ]
100
claus
parents: 98
diff changeset
   500
    ].
claus
parents: 98
diff changeset
   501
    (v notNil and:[v respondsTo:#model]) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   502
        (model := v model) notNil ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   503
            (model respondsTo:#helpTextFor:at:) ifTrue:[
1100
5f25636fad8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
   504
                text := model helpTextFor:aView at:p.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   505
                text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   506
            ].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   507
            (model respondsTo:#helpTextFor:) ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   508
                text := model helpTextFor:aView.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   509
                text notNil ifTrue:[^ text].
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   510
            ]
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   511
        ]
100
claus
parents: 98
diff changeset
   512
    ].
claus
parents: 98
diff changeset
   513
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   514
    (view class respondsTo:#helpText) ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   515
        text := view class helpText.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   516
        text notNil ifTrue:[^ text].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   517
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   518
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   519
    ^ nil
100
claus
parents: 98
diff changeset
   520
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   521
    "Modified: / 31.8.1995 / 20:38:00 / claus"
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   522
    "Modified: / 28.7.1998 / 01:47:27 / cg"
100
claus
parents: 98
diff changeset
   523
!
claus
parents: 98
diff changeset
   524
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   525
hideIfPointerLeft:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   526
    "hide help, if the pointer is not in aView"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   527
696
a49928754789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 639
diff changeset
   528
    |whereOnScreen|
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   529
276
19b205dde532 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   530
    whereOnScreen := aView graphicsDevice pointerPosition.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   531
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   532
    (currentFrame notNil
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   533
    and:[(currentFrame insetBy:1@1) containsPoint:whereOnScreen]) ifFalse:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   534
        self hideHelp.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   535
        currentView := nil
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   536
    ].
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   537
276
19b205dde532 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   538
    "Modified: 28.5.1996 / 20:18:28 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   539
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   540
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   541
interestedIn:aView
1033
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   542
    "return true, if I am interested in aView (either listeningForAll,
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   543
     or in my list of apps)"
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   544
1106
414b7cfe57b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   545
    |app aViewsTopView|
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   546
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   547
    listeningForAll == true ifTrue:[^ true].
1033
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   548
    aView isNil ifTrue:[^ false].
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   549
1106
414b7cfe57b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   550
    aViewsTopView := aView topView.
414b7cfe57b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   551
    (applicationsOrTopViewsWithHelp includesIdentical:aViewsTopView) ifTrue:[^ true].
414b7cfe57b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   552
    app := aViewsTopView application.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   553
    app notNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   554
        (applicationsOrTopViewsWithHelp includesIdentical:app) ifTrue:[^ true]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   555
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   556
    ^ false
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   557
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   558
    "Created: / 26.10.1997 / 23:28:52 / cg"
1033
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   559
    "Modified: / 8.8.1998 / 13:36:19 / cg"
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   560
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   561
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   562
stopHelpDisplayProcess
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   563
    |p|
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   564
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   565
    showProcess notNil ifTrue:[
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   566
        p := showProcess. showProcess := nil.
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   567
        p terminate.
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   568
    ].
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   569
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   570
    "Created: 28.6.1997 / 14:03:17 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   571
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   572
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   573
!ActiveHelp methodsFor:'show / hide help'!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   574
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   575
hideHelp
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   576
    "hide the help text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   577
98
claus
parents: 97
diff changeset
   578
    |p|
claus
parents: 97
diff changeset
   579
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   580
    self stopHelpDisplayProcess.
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   581
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   582
    currentHelpView notNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   583
        [
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   584
            currentHelpView destroy.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   585
            currentHelpView := nil.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   586
            currentView := nil.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   587
        ] valueUninterruptably
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   588
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   589
    currentFrame := nil.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   590
    closeProcess notNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   591
        p := closeProcess. closeProcess := nil.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   592
        p terminate.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   593
    ]
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   594
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   595
    "Modified: 28.6.1997 / 14:03:50 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   596
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   597
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   598
initiateHelpFor:aView atX:x y:y
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   599
    "ask aView for helpText, passing x/y coordinates;
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   600
     start a timeout process to display this helpText after some delay;
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   601
     Normally used internally, but can also be used by widgets to force 
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   602
     re-negotiation of the displayed helpText 
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   603
     (for example in a menu, when the selection changes)"
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   604
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   605
    self
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   606
        initiateHelpFor:aView atX:x y:y now:false
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   607
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   608
    "Modified: 28.6.1997 / 14:45:57 / cg"
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   609
!
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   610
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   611
initiateHelpFor:aView atX:x y:y now:showItNow
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   612
    "ask aView for helpText, passing x/y coordinates;
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   613
     start a timeout process to display this helpText after some delay;
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   614
     Normally used internally, but can also be used by widgets to force 
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   615
     re-negotiation of the displayed helpText 
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   616
     (for example in a menu, when the selection changes)"
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   617
696
a49928754789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 639
diff changeset
   618
    |text top app|
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   619
1143
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   620
    (self interestedIn:aView) ifFalse:[
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   621
        ^ self
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   622
    ].
1142
b223ada4e9f3 allow for nil position in #initiateHelpFor:
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   623
    x isNil ifTrue:[
b223ada4e9f3 allow for nil position in #initiateHelpFor:
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   624
        text := aView helpText
b223ada4e9f3 allow for nil position in #initiateHelpFor:
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   625
    ] ifFalse:[
b223ada4e9f3 allow for nil position in #initiateHelpFor:
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   626
        text := self helpTextFor:aView atX:x y:y.
b223ada4e9f3 allow for nil position in #initiateHelpFor:
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   627
    ].
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   628
    lastHelpText = text ifTrue:[
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   629
        ^ self
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   630
    ].
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   631
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   632
    "/ give the views application a chance
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   633
    "/ to decide where to show the help text
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   634
    "/ (i.e. in its own information area)
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   635
    "/ nil is also passed down, to give it a chance
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   636
    "/ to clean its infoDisplay.
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   637
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   638
    top := aView topView.
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   639
    (app := aView application) notNil ifTrue:[
1019
862f095da4ac #showHelp:for: renamed to #showActiveHelp:for:
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
   640
        (app showActiveHelp:text for:aView) ifTrue:[
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   641
            lastHelpText := text.
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   642
            ^ self
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   643
        ]
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   644
    ].
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   645
1143
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   646
    text size > 0 ifTrue:[
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   647
        (showItNow not and:[DelayTime > 0]) ifTrue:[
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   648
            self stopHelpDisplayProcess.
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   649
            showProcess := [
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   650
                    Delay waitForSeconds:DelayTime.
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   651
                    showProcess := nil.
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   652
                    self showHelp:text for:aView
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   653
            ] forkAt:(Processor userSchedulingPriority + 1).
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   654
        ] ifFalse:[
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   655
            self showHelp:text for:aView
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   656
        ]
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   657
    ].
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   658
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   659
    "
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   660
     can be used in a widget as:
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   661
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   662
        ActiveHelp isActive ifTrue:[
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   663
            ActiveHelp currentHelpListener
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   664
                initiateHelpFor:self atX:x y:y
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   665
            ]
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   666
        ]
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   667
    "
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   668
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   669
    "Created: / 28.6.1997 / 14:45:41 / cg"
1143
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   670
    "Modified: / 15.3.1999 / 08:38:14 / cg"
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   671
!
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   672
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   673
showHelp:aHelpText for:view
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   674
    "show the help text for aView"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   675
696
a49928754789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 639
diff changeset
   676
    |org p v dev|
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   677
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   678
    view == currentView ifTrue:[
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   679
        lastHelpText = aHelpText ifTrue:[
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   680
            ^ self
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   681
        ]
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   682
    ].
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   683
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   684
    lastHelpText := aHelpText.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   685
92
claus
parents: 59
diff changeset
   686
    closeProcess notNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   687
        p := closeProcess. closeProcess := nil.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   688
        p terminate.
92
claus
parents: 59
diff changeset
   689
    ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   690
    currentHelpView notNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   691
        self hideHelp
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   692
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   693
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   694
    org := view originRelativeTo:nil.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   695
    currentFrame := org extent:view extent.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   696
    org :=org + (view extent // 2).
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   697
100
claus
parents: 98
diff changeset
   698
    v := ActiveHelpView for:aHelpText withCRs.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   699
276
19b205dde532 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   700
    dev := view graphicsDevice.
19b205dde532 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   701
    org := dev pointerPosition.
100
claus
parents: 98
diff changeset
   702
    org := org + (10@10).
276
19b205dde532 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   703
    (org x + v width) > dev width ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   704
        org := (org x - v width) @ org y
92
claus
parents: 59
diff changeset
   705
    ].
276
19b205dde532 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   706
    (org y + v height) > dev height ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   707
        org := org x @ (org y - v height).
92
claus
parents: 59
diff changeset
   708
    ].
claus
parents: 59
diff changeset
   709
100
claus
parents: 98
diff changeset
   710
    v origin:org.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   711
"/    currentHelpView open.
100
claus
parents: 98
diff changeset
   712
    v realize.
claus
parents: 98
diff changeset
   713
    v enableButtonMotionEvents.
claus
parents: 98
diff changeset
   714
    v enableMotionEvents.
claus
parents: 98
diff changeset
   715
    currentHelpView := v.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   716
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   717
    currentView := view.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   718
    closeProcess := [
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   719
        [
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   720
            (Delay forSeconds:ShowTime) wait.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   721
            [
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   722
                currentHelpView notNil ifTrue:[
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   723
                    currentHelpView destroy.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   724
                    currentHelpView := nil.
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   725
                ]
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   726
            ] valueUninterruptably
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   727
        ] valueOnUnwindDo:[
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   728
            closeProcess := nil.
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   729
        ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   730
    ] forkAt:(Processor userSchedulingPriority + 1).
100
claus
parents: 98
diff changeset
   731
claus
parents: 98
diff changeset
   732
    "Modified: 31.8.1995 / 19:20:45 / claus"
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   733
    "Modified: 28.6.1997 / 14:45:15 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   734
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   735
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   736
!ActiveHelp methodsFor:'start & stop'!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   737
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   738
listenFor:anAppOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   739
    "start listening"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   740
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   741
    applicationsOrTopViewsWithHelp isNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   742
        applicationsOrTopViewsWithHelp := WeakIdentitySet new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   743
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   744
    applicationsOrTopViewsWithHelp add:anAppOrTopView.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   745
    super listen.
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   746
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   747
    "Created: / 26.10.1997 / 23:20:47 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   748
    "Modified: / 26.10.1997 / 23:21:10 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   749
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   750
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   751
listenForAll
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   752
    "start listening"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   753
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   754
    listeningForAll := true.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   755
    super listen.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   756
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   757
    "Modified: / 28.6.1997 / 15:07:02 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   758
    "Created: / 26.10.1997 / 23:19:30 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   759
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   760
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   761
unlistenAll
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   762
    "stop listening"
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   763
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   764
    self hideHelp.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   765
    listeningForAll := false.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   766
    applicationsOrTopViewsWithHelp size == 0 ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   767
        super unlisten.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   768
    ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   769
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   770
    "Created: / 26.10.1997 / 23:14:17 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   771
    "Modified: / 26.10.1997 / 23:23:04 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   772
!
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   773
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   774
unlistenFor:anApp
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   775
    "stop listening for an app"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   776
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   777
    self hideHelp.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   778
    applicationsOrTopViewsWithHelp remove:anApp ifAbsent:nil.
726
cdab756aebe4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   779
    listeningForAll == true ifFalse:[
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   780
        applicationsOrTopViewsWithHelp size == 0 ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   781
            super unlisten.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   782
        ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   783
    ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   784
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   785
    "Created: / 26.10.1997 / 23:22:42 / cg"
726
cdab756aebe4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   786
    "Modified: / 29.10.1997 / 15:48:34 / cg"
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   787
! !
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   788
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   789
!ActiveHelp class methodsFor:'documentation'!
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   790
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   791
version
1143
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   792
    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.39 1999-03-15 10:54:48 cg Exp $'
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   793
! !
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   794
ActiveHelp initialize!