ActiveHelp.st
author Claus Gittinger <cg@exept.de>
Thu, 02 Aug 2018 17:14:25 +0200
changeset 4153 c7afa8b79aa7
parent 4134 92df688b5ffe
child 4167 3ebfb7658859
permissions -rw-r--r--
#REFACTORING by cg class: ActiveHelp preps for help in popup views added: #keyRelease:x:y:view: comment/format in: #buttonMotion:x:y:view: changed: #handleMouseIn:x:y: #keyPress:x:y:view:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
     1
"{ Encoding: utf8 }"
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
     2
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     3
"
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     4
 COPYRIGHT (c) 1995 by Claus Gittinger
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     5
	      All Rights Reserved
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     6
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    13
"
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
    14
"{ Package: 'stx:libview2' }"
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
    15
3447
5ca2fac37ecd class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
    16
"{ NameSpace: Smalltalk }"
5ca2fac37ecd class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
    17
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    18
EventListener subclass:#ActiveHelp
3227
4c3a5cca2b9e class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3219
diff changeset
    19
	instanceVariableNames:'lastHelpText listeningForAll applicationsOrTopViewsWithHelp
4118
fc66f1e06073 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
    20
		lastHelpWidget lastPointerPosition pointerPositionAtShowTime'
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
    21
	classVariableNames:'Debugging DebuggingHelpText DebuggingEvents'
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    22
	poolDictionaries:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 138
diff changeset
    23
	category:'Interface-Help'
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    24
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    25
1892
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    26
ActiveHelp class instanceVariableNames:'DelayTime ShowTime TheOneAndOnlyHelpListener'
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    27
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    28
"
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    29
 No other class instance variables are inherited by this class.
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    30
"
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    31
!
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
    32
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    33
!ActiveHelp class methodsFor:'documentation'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    34
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    35
copyright
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    36
"
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    37
 COPYRIGHT (c) 1995 by Claus Gittinger
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    38
	      All Rights Reserved
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    39
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    40
 This software is furnished under a license and may be used
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    41
 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
    42
 inclusion of the above copyright notice.   This software may not
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    43
 be provided or otherwise made available to, or used by, any
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    44
 other person.  No title to or ownership of the software is
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    45
 hereby transferred.
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    46
"
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
    47
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    48
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    49
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    50
documentation
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
    51
"
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
    52
    The active help (tooltip) listener.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    53
98
claus
parents: 97
diff changeset
    54
    The one and only instance of myself intercepts incoming mouse & keyboard 
claus
parents: 97
diff changeset
    55
    events for the display device, being especially interested in view-enter/
636
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    56
    leave events. When such an event arrives, it asks the corresponding view
3219
eca34010e99b class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3197
diff changeset
    57
    or its model for a help message and displays it via an ActiveHelpView.
eca34010e99b class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3197
diff changeset
    58
    Actually, the view is first asked if it would like to display it itself
eca34010e99b class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3197
diff changeset
    59
    - for example, in some information-view at the bottom of its main window.
636
446b52f2c603 comments
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
    60
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
    61
    The query for the helpText is repeated along the view's superView chain, 
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
    62
    until any model or view returns a nonNil answer for the 
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
    63
    #helpTextFor:<aSubView> at:<position> or #helpTextFor:<aSubView> message.
100
claus
parents: 98
diff changeset
    64
98
claus
parents: 97
diff changeset
    65
    All I need for automatic help is some model/view/applicationModel along
claus
parents: 97
diff changeset
    66
    the superview chain of the entered component, which responds to the
claus
parents: 97
diff changeset
    67
    #helpTextFor: message with a non-nil (string-) answer.
claus
parents: 97
diff changeset
    68
    I close down the help view after a while, if a key is pressed or the mouse
claus
parents: 97
diff changeset
    69
    moved to another view.
100
claus
parents: 98
diff changeset
    70
claus
parents: 98
diff changeset
    71
    Who should provide the helpText:
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    72
        the best place is the application object (an instance of ApplicationModel)
3884
a6ad1eb5a5e6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3790
diff changeset
    73
        or the topView, if it's a derived class of StandardSystemView.
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    74
        This should know about its components and return the string
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
    75
        when asked via #helpTextFor:<aSubView>.
330
d7ce98930ad3 Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents: 297
diff changeset
    76
        See examples in FileBrowser, Launcher etc.
100
claus
parents: 98
diff changeset
    77
claus
parents: 98
diff changeset
    78
    Be aware, that for applicationModels, there must be a link from the
claus
parents: 98
diff changeset
    79
    topView to this applicationModel 
claus
parents: 98
diff changeset
    80
    (set via: aTopView application:anApplicationModel)
claus
parents: 98
diff changeset
    81
    otherwise, the helpManager has no means of finding the application which
claus
parents: 98
diff changeset
    82
    corresponds to a view.
claus
parents: 98
diff changeset
    83
claus
parents: 98
diff changeset
    84
    Who should display the helpText:
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    85
        by default, the helpListener opens a little popup view, which displays the
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    86
        returned help message. However, a nice trick which can be used by applications
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    87
        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
    88
        and display the text right in the #helpTextFor: method. To cheat the
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    89
        help listener, this method should then return nil, to keep it silent.
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    90
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    91
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    92
    Usage:
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    93
        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
    94
        use 'ActiveHelp start' and 'ActiveHelp stop'.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    95
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    96
        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
    97
        '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
    98
        the topView or the topViews application as argument.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
    99
        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
   100
        some infoView.
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   101
        Late note: thsi is no longer recommended - one such mouse watcher process is
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   102
        good enough for all views.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   103
        
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   104
    [author:]
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   105
        Claus Gittinger
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   106
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   107
    [start with:]
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   108
        ActiveHelp start
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   109
        ActiveHelp stop
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   110
221
ea942fe5dc04 documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   111
    [See also:]
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   112
        ActiveHelpView
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   113
        WindowGroup WindowEvent
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   114
        ApplicationModel StandardSystemView
100
claus
parents: 98
diff changeset
   115
"
claus
parents: 98
diff changeset
   116
!
claus
parents: 98
diff changeset
   117
claus
parents: 98
diff changeset
   118
examples
claus
parents: 98
diff changeset
   119
"
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   120
  Active Help for a single view
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   121
  or app (whatever the global settings are):
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   122
  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
   123
                                                                        [exBegin]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   124
        |app top myAppClass|
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   125
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   126
        Class withoutUpdatingChangesDo:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   127
            myAppClass := ApplicationModel 
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   128
                            subclass:#'Demos::DemoApp'
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   129
                            instanceVariableNames:''
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   130
                            classVariableNames:''
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   131
                            poolDictionaries:''
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   132
                            category:'demos'.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   133
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   134
            myAppClass 
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   135
                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
   136
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   137
        ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   138
        app := myAppClass new.
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
        top := StandardSystemView new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   141
        top extent:300@100.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   142
        top application:app.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   143
        top open.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   144
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   145
        ActiveHelp startFor:app.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   146
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   147
        Class withoutUpdatingChangesDo:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   148
            myAppClass removeFromSystem
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   149
        ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   150
                                                                        [exEnd]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   151
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   152
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   153
  Active Help (for all views):
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   154
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   155
    (make certain that activeHelp is turned on ...
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   156
     ... otherwise, you will see nothing)
100
claus
parents: 98
diff changeset
   157
claus
parents: 98
diff changeset
   158
    the following example uses a Plug as a model replacement.
claus
parents: 98
diff changeset
   159
    In concrete application, you would create a method to implement the helpText
claus
parents: 98
diff changeset
   160
    query message.
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   161
                                                                        [exBegin]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   162
        |app top button1 button2|
100
claus
parents: 98
diff changeset
   163
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   164
        app := Plug new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   165
        app respondTo:#helpTextFor:
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   166
                 with:[:view | 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   167
                               view == button1 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   168
                                 'this is button1'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   169
                               ] ifFalse:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   170
                                 view == button2 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   171
                                   'some help for button2'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   172
                                 ] ifFalse:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   173
                                   nil
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   174
                                 ]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   175
                               ]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   176
                      ].
100
claus
parents: 98
diff changeset
   177
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   178
        top := StandardSystemView new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   179
        top extent:300@100.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   180
        button1 := Button label:'b1' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   181
        button1 origin:0.0@0.0 corner:0.5@30. 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   182
        button2 := Button label:'b2' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   183
        button2 origin:0.5@0.0 corner:1.0@30.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   184
        top model:app. '<-- normally this would be: top application:app'.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   185
        top open
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   186
                                                                        [exEnd]
100
claus
parents: 98
diff changeset
   187
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   188
    (make certain that activeHelp is turned on ...
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   189
     ... otherwise, you will see nothing)
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   190
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   191
    alternatively, display of the helpMessage in a local, private view:
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   192
                                                                        [exBegin]
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   193
        |app top button1 button2 infoView|
100
claus
parents: 98
diff changeset
   194
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   195
        app := Plug new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   196
        app respondTo:#helpTextFor:
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   197
                 with:[:view | infoView label:'info ...'.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   198
                               view == button1 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   199
                                 infoView label:'this is button1'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   200
                               ].
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   201
                               view == button2 ifTrue:[
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   202
                                 infoView label:'some help for button2'
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   203
                               ].
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   204
                               nil
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   205
                      ].
100
claus
parents: 98
diff changeset
   206
227
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   207
        top := StandardSystemView new.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   208
        top extent:300@100.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   209
        button1 := Button label:'b1' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   210
        button1 origin:0.0@0.0 corner:0.5@30. 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   211
        button2 := Button label:'b2' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   212
        button2 origin:0.5@0.0 corner:1.0@30.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   213
        infoView := Label label:'info ...' in:top.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   214
        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
   215
        infoView topInset:(infoView preferredExtent y negated - 3);
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   216
                 leftInset:3; 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   217
                 rightInset:3; 
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   218
                 bottomInset:3;
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   219
                 adjust:#left.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   220
        top model:app. '<-- normally this would be: top application:app'.
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   221
        top open
3f18af678ac9 examples for docViewer
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   222
                                                                        [exEnd]
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   223
"
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   224
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   225
3320
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   226
!ActiveHelp class methodsFor:'initialization'!
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   227
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   228
initialize
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   229
    Debugging := false.
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   230
    DebuggingEvents := false.
4122
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   231
    DebuggingHelpText := false.
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   232
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   233
    "Modified: / 19-06-2018 / 12:53:36 / Claus Gittinger"
3320
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   234
! !
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   235
2975
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   236
!ActiveHelp class methodsFor:'accessing'!
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   237
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   238
debugging
4122
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   239
    ^ Debugging ? false
2975
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   240
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   241
    "Modified: / 22-12-2011 / 10:46:30 / cg"
4122
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   242
    "Modified: / 11-06-2018 / 10:27:40 / Claus Gittinger"
2975
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   243
!
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   244
4122
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   245
debugging:aBoolean
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   246
    Debugging := aBoolean.
2975
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   247
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   248
    "
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   249
     self debugging:true
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   250
     self debugging:false
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   251
    "
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   252
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   253
    "Modified (comment): / 22-12-2011 / 10:43:32 / cg"
4122
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   254
    "Modified (format): / 11-06-2018 / 10:30:30 / Claus Gittinger"
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   255
!
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   256
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   257
debuggingHelpText
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   258
    ^ DebuggingHelpText ? false
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   259
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   260
    "Created: / 11-06-2018 / 10:30:10 / Claus Gittinger"
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   261
!
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   262
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   263
debuggingHelpText:aBoolean
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   264
    DebuggingHelpText := aBoolean.
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   265
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   266
    "
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   267
     self debuggingHelpText:true
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   268
     self debuggingHelpText:false
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   269
    "
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   270
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   271
    "Created: / 11-06-2018 / 10:30:24 / Claus Gittinger"
2975
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   272
! !
7afae6c8a8e3 class definition
Claus Gittinger <cg@exept.de>
parents: 2915
diff changeset
   273
633
5d162347fac8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   274
!ActiveHelp class methodsFor:'queries'!
100
claus
parents: 98
diff changeset
   275
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   276
currentHelpListener
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   277
    "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
   278
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   279
    ^ TheOneAndOnlyHelpListener
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   280
3395
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   281
    "
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   282
     ActiveHelp currentHelpListener
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   283
     FlyByHelp currentHelpListener
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   284
    "
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   285
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   286
    "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
   287
!
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   288
1892
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
   289
delayTime
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   290
    ^ DelayTime ? 0.4
1892
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
   291
!
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
   292
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   293
isActive
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   294
    "return true, if activeHelp is turned on"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   295
3347
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   296
    TheOneAndOnlyHelpListener notNil ifTrue:[
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   297
        ((WindowSensor eventListeners ? #()) includesIdentical:TheOneAndOnlyHelpListener) ifTrue:[
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   298
            ^ true
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   299
        ].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   300
        TheOneAndOnlyHelpListener := nil.
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   301
    ].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   302
    ^ false.
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   303
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   304
    "
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   305
     FlyByHelp isActive
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   306
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   307
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   308
    "Modified: 27.4.1996 / 15:07:57 / cg"
1892
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
   309
!
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
   310
4c38a0c4369b *** empty log message ***
ca
parents: 1768
diff changeset
   311
showTime
2879
9f0f872a8f60 lazy init
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   312
    "set the number of seconds, a help messages is to be shown.
3447
5ca2fac37ecd class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
   313
     The default is 45 seconds.
3333
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   314
     0 means: show forever (i.e. until mouse is moved)"
2879
9f0f872a8f60 lazy init
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   315
3447
5ca2fac37ecd class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3417
diff changeset
   316
    ^ ShowTime ? 45
2879
9f0f872a8f60 lazy init
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   317
9f0f872a8f60 lazy init
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   318
    "Modified: / 10-11-2010 / 12:29:44 / cg"
633
5d162347fac8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   319
! !
5d162347fac8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   320
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   321
!ActiveHelp class methodsFor:'start & stop'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   322
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   323
start
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   324
    "start activeHelp for all apps"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   325
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   326
    TheOneAndOnlyHelpListener notNil ifTrue:[
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   327
        TheOneAndOnlyHelpListener stop.    
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   328
        TheOneAndOnlyHelpListener := nil.    
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   329
    ].
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   330
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   331
    TheOneAndOnlyHelpListener isNil ifTrue:[
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   332
        TheOneAndOnlyHelpListener := self new.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   333
    ].
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   334
    TheOneAndOnlyHelpListener start.
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   335
    ^ TheOneAndOnlyHelpListener
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   336
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   337
    "
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   338
     ActiveHelp start
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   339
     FlyByHelp start
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   340
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   341
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   342
    "Modified: / 26.10.1997 / 23:16:54 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   343
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   344
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   345
startFor:anApplicationOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   346
    "start activeHelp for a single app"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   347
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   348
    TheOneAndOnlyHelpListener isNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   349
        TheOneAndOnlyHelpListener := self new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   350
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   351
    TheOneAndOnlyHelpListener listenFor:anApplicationOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   352
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   353
    "Modified: / 26.10.1997 / 23:17:05 / cg"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   354
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   355
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   356
stop
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   357
    "stop activeHelp for all (except for individual apps)"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   358
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   359
    TheOneAndOnlyHelpListener notNil ifTrue:[
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   360
        TheOneAndOnlyHelpListener stop.
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   361
        TheOneAndOnlyHelpListener := nil.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   362
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   363
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   364
    "
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   365
     ActiveHelp stop
1543
95c5048dd99a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1541
diff changeset
   366
     FlyByHelp stop
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   367
    "
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   368
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   369
    "Modified: / 26.10.1997 / 23:18:58 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   370
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   371
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   372
stopFor:anAppOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   373
    "stop activeHelp for a single app"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   374
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   375
    TheOneAndOnlyHelpListener notNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   376
        TheOneAndOnlyHelpListener unlistenFor:anAppOrTopView.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   377
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   378
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   379
    "Modified: / 26.10.1997 / 23:12:55 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   380
    "Created: / 26.10.1997 / 23:18:41 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   381
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   382
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   383
!ActiveHelp class methodsFor:'times'!
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   384
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   385
delayTime:numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   386
    "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
   387
     before help is shown). The default is 2 seconds."
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   388
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   389
    DelayTime := numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   390
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   391
    "
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   392
     ActiveHelp delayTime:0.5
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   393
     ActiveHelp delayTime:2
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   394
     ActiveHelp delayTime:10
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   395
    "
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   396
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   397
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   398
showTime:numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   399
    "set the number of seconds, a help messages is to be shown.
3333
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   400
     The default is 30 seconds.
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   401
     0 means: show forever (i.e. until mouse is moved)"
138
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
    ShowTime := numberOfSeconds
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   404
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   405
    "
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   406
     ActiveHelp showTime:10
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   407
     ActiveHelp showTime:99999 
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   408
     ActiveHelp showTime:30
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   409
    "
2879
9f0f872a8f60 lazy init
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   410
9f0f872a8f60 lazy init
Claus Gittinger <cg@exept.de>
parents: 2783
diff changeset
   411
    "Modified: / 10-11-2010 / 12:29:40 / cg"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   412
! !
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   413
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   414
!ActiveHelp methodsFor:'event handling'!
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   415
2473
66754ea64440 code cleanup (arg-names)
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   416
buttonMotion:buttonAndModifierState x:x y:y view:aView
1657
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   417
    "handle motion events - prepare to show help"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   418
2782
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   419
    |realViewUnderCursor realP|
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   420
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   421
    "/ Debugging := true
2473
66754ea64440 code cleanup (arg-names)
Claus Gittinger <cg@exept.de>
parents: 2391
diff changeset
   422
    buttonAndModifierState == 0 ifTrue:[
2783
cb3420e40ed1 changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 2782
diff changeset
   423
"/        realViewUnderCursor := aView device viewFromPoint:(aView pointerPosition).
cb3420e40ed1 changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 2782
diff changeset
   424
"/        realP := aView device translatePoint:(x@y) fromView:aView toView:realViewUnderCursor.
cb3420e40ed1 changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 2782
diff changeset
   425
"/        self handleMouseIn:realViewUnderCursor x:realP x y:realP y.
3292
5420f7447205 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   426
        Debugging ifTrue:['motion' infoPrintCR].
2783
cb3420e40ed1 changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents: 2782
diff changeset
   427
        self handleMouseIn:aView x:x y:y.
1948
33eb423a6fd3 only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   428
    ].
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   429
    ^ false
4122
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   430
900bfc4b45d5 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4118
diff changeset
   431
    "Modified: / 11-06-2018 / 10:31:42 / Claus Gittinger"
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   432
    "Modified (format): / 02-08-2018 / 16:12:45 / Claus Gittinger"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   433
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   434
4123
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   435
handleMouseIn:aView x:x y:y
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   436
    "handle motion events - if the mousepointer left the 
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   437
     previous helped view, hide the help"
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   438
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   439
    "/ Debugging := true. 
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   440
    "/ Debugging := false. 
4123
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   441
    Debugging ifTrue:['mouse in' infoPrintCR].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   442
    (self interestedIn:aView) ifFalse:[
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   443
        Debugging ifTrue:[Timestamp now infoPrint. ' - not interested 0' infoPrintCR].
4123
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   444
        ^ self
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   445
    ].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   446
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   447
    Error handle:[:ex |
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   448
        InfoPrinting == true ifTrue:[
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   449
            '---------------------' infoPrintCR.
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   450
            ex description infoPrintCR.
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   451
            ex suspendedContext fullPrintAll.
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   452
        ].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   453
    ] do:[
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   454
        |sensor|
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   455
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   456
        "/ self stopHelpDisplayProcess.
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   457
        Debugging ifTrue:['hideIf' infoPrintCR].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   458
        self hideIfPointerLeft:aView.
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   459
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   460
        "/ check again, in case the stop/hide changed something...
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   461
        (self interestedIn:aView) ifFalse:[
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   462
            Debugging ifTrue:['not interested2' infoPrintCR].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   463
            ^ self
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   464
        ].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   465
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   466
        "/ if there is a sensor, let the view do it itself (in its process)
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   467
        (self targetViewInitiatesHelpViaSensor
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   468
        and:[ (sensor := aView sensor) notNil ])
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   469
        ifTrue:[
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   470
            Debugging ifTrue:['target shows help' infoPrintCR].
4123
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   471
            sensor flushEventsFor:self withType:#initiateHelpFor:at:.
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   472
            sensor 
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   473
                pushUserEvent:#initiateHelpFor:at: for:self 
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   474
                withArguments:(Array with:aView with:(x @ y)).
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   475
        ] ifFalse:[
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   476
            Debugging ifTrue:['I show help' infoPrintCR].
4123
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   477
            self initiateHelpFor:aView at:(x @ y).
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   478
        ]
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   479
    ].
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   480
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   481
    "Modified: / 02-08-2018 / 16:17:34 / Claus Gittinger"
4123
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   482
!
7335deef08c3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4122
diff changeset
   483
1591
4e75531ffacf checkin from browser
tm
parents: 1549
diff changeset
   484
keyPress:key x:x y:y view:view
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   485
    "unconditionally hide the help view"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   486
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   487
    Debugging ifTrue:['key press: ' infoPrint. key infoPrintCR].
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   488
    key == #Help ifTrue:[
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   489
        self initiateHelpFor:view at:(x @ y).
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   490
        ^ true.
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   491
    ].    
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   492
    self hideHelpIgnoringErrors.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   493
    ^ false
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   494
4153
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   495
    "Modified: / 27-04-1996 / 15:09:57 / cg"
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   496
    "Modified: / 02-08-2018 / 16:50:25 / Claus Gittinger"
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   497
!
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   498
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   499
keyRelease:key x:x y:y view:view
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   500
    "unconditionally hide the help view"
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   501
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   502
    Debugging ifTrue:['key release: ' infoPrint. key infoPrintCR].
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   503
    key == #Help ifTrue:[
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   504
    ].    
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   505
    self hideHelpIgnoringErrors.
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   506
    ^ false
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   507
c7afa8b79aa7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4134
diff changeset
   508
    "Created: / 02-08-2018 / 16:16:19 / Claus Gittinger"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   509
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   510
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   511
pointerEnter:state x:x y:y view:aView
1657
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   512
    "handle pointer entering a view; prepare to show help"
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   513
1948
33eb423a6fd3 only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   514
    state == 0 ifTrue:[
33eb423a6fd3 only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   515
        self handleMouseIn:aView x:x y:y.
33eb423a6fd3 only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   516
    ].    
1657
447db4aae998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1591
diff changeset
   517
    ^ false
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   518
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   519
2371
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   520
pointerLeave:state view:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   521
    "handle pointer leaving a view; hide help text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   522
2371
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   523
    |sensor|
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   524
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   525
    sensor := aView sensor.
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   526
    sensor notNil ifTrue:[
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   527
        sensor flushEventsFor:self withType:#initiateHelpFor:at:.
4ab6c8c7bc03 flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents: 2130
diff changeset
   528
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   529
    self hideHelpIgnoringErrors.
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   530
    ^ false
2914
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   531
!
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   532
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   533
processEvent:ev
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   534
    DebuggingEvents == true ifTrue:[
3507
Claus Gittinger <cg@exept.de>
parents: 3447
diff changeset
   535
        'event: ' infoPrint. ev class nameWithoutPrefix infoPrint.
Claus Gittinger <cg@exept.de>
parents: 3447
diff changeset
   536
        ' view:' infoPrint. ev view infoPrintCR.
3292
5420f7447205 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   537
    ].
2914
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   538
    (ev isPointerEnterLeaveEvent
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   539
    or:[ ev isButtonEvent
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   540
    or:[ ev isKeyEvent ]]) ifTrue:[
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   541
        ^ ev dispatchWithViewArgumentTo:self    
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   542
    ].
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   543
    ^ false
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   544
18cff2d0daff change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents: 2879
diff changeset
   545
    "Created: / 29-06-2011 / 18:22:43 / cg"
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   546
    "Modified: / 19-06-2018 / 12:53:28 / Claus Gittinger"
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   547
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   548
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   549
!ActiveHelp methodsFor:'help texts'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   550
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   551
helpTextFor:aView at:aDevicePointOrNil 
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   552
    "retrieve helptext for aView as a string; 
3790
94221f42c94d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3665
diff changeset
   553
     walk along the view's superView chain,
100
claus
parents: 98
diff changeset
   554
     asking models and views encountered while walking.
claus
parents: 98
diff changeset
   555
     The first one who understands and returns a nonNil answer to the
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   556
     #helpTextFor:at: or #helpTextFor: message ends this search and the
100
claus
parents: 98
diff changeset
   557
     returned string is returned."
claus
parents: 98
diff changeset
   558
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   559
    |model app1 app2 text v sv topView domainPointOrNil|
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   560
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   561
    aView transformation notNil ifTrue:[
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   562
        domainPointOrNil := aView transformation applyInverseTo:aDevicePointOrNil.
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   563
    ] ifFalse:[
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   564
        domainPointOrNil := aDevicePointOrNil.
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   565
    ].
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   566
3665
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   567
    "/ done below
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   568
    "/    text := self helpTextFromView:aView at:domainPointOrNil.
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   569
    "/    text notNil ifTrue:[ ^ text ].
2076
5a9d0932133b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1996
diff changeset
   570
1549
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   571
    ((aView respondsTo:#application)
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   572
    and:[ (app1 := aView application) notNil ]) ifTrue:[
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   573
        text := self helpTextFromModel:app1 view:aView at:domainPointOrNil.
1549
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   574
        text notNil ifTrue:[ ^ text ].
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   575
    ] ifFalse:[
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   576
        "/ old style (i.e. StandardSystemView ...)
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   577
        topView := aView topView.
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   578
        text := self helpTextFromModel:topView view:aView at:domainPointOrNil.
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   579
        text notNil ifTrue:[ ^ text ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   580
    ].
1549
1b5274878f87 care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
   581
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   582
    (model := aView model) notNil ifTrue:[
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   583
        model ~~ app1 ifTrue:[
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   584
            text := self helpTextFromModel:model view:aView at:domainPointOrNil.
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   585
            text notNil ifTrue:[ ^ text ].
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   586
        ].
1011
53514f2c18a7 also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents: 728
diff changeset
   587
    ].
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   588
    text := self helpTextFromView:aView at:domainPointOrNil.
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   589
    text notNil ifTrue:[
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   590
         ^ text 
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   591
    ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   592
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   593
    "walk up the chain - maybe someone knows about its subview ..."
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   594
    v := aView.
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   595
    [
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   596
        (sv := v container) notNil
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   597
    ] whileTrue:[
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   598
        (model := sv model) notNil ifTrue:[
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   599
            text := self helpTextFromModel:model view:aView at:domainPointOrNil.
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   600
            text notNil ifTrue:[ ^ text ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   601
        ].
3665
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   602
        "/ maybe the topView knows something about a higher-up widget...
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   603
        text := self helpTextFromModel:topView view:sv at:domainPointOrNil.
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   604
        text notNil ifTrue:[ ^ text ].
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   605
        
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   606
        text := self helpTextFromView:sv at:nil.
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   607
        text notNil ifTrue:[ ^ text ].
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   608
        v := sv
602
b1ac53a44327 application and help
ca
parents: 596
diff changeset
   609
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   610
4038
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   611
    v notNil ifTrue:[
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   612
        ((v respondsTo:#application) and:[(app2 := v application) notNil]) ifTrue:[
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   613
            (app2 ~~ app1) ifTrue:[
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   614
                text := self helpTextFromModel:app2 view:aView at:domainPointOrNil.
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   615
                text notNil ifTrue:[ ^ text ].
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   616
            ]
4038
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   617
        ].
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   618
        ((v respondsTo:#model) and:[(model := v model) notNil]) ifTrue:[
2130
31edece2051b care for transformations.
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
   619
            text := self helpTextFromModel:model view:aView at:domainPointOrNil.
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   620
            text notNil ifTrue:[ ^ text ].
4038
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   621
        ].
100
claus
parents: 98
diff changeset
   622
    ].
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   623
    ^ nil
100
claus
parents: 98
diff changeset
   624
4038
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   625
    "Modified: / 31-08-1995 / 20:38:00 / claus"
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   626
    "Modified: / 28-07-1998 / 01:47:27 / cg"
95870c29b6b4 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3884
diff changeset
   627
    "Modified: / 09-01-2018 / 16:46:37 / stefan"
100
claus
parents: 98
diff changeset
   628
!
claus
parents: 98
diff changeset
   629
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   630
helpTextFromModel:aModelOrTopView view:aView at:aPointOrNil 
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   631
    "helper: ask aModel for its helpText."
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   632
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   633
    |text|
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   634
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   635
    aPointOrNil notNil ifTrue:[
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   636
        (aModelOrTopView respondsTo:#helpTextFor:at:) ifTrue:[
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   637
            text := aModelOrTopView helpTextFor:aView at:aPointOrNil.
2076
5a9d0932133b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1996
diff changeset
   638
            text notNil ifTrue:[^ text].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   639
        ].
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   640
    ].
3664
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   641
    (aModelOrTopView respondsTo:#helpTextFor:) ifTrue:[
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   642
        text := aModelOrTopView helpTextFor:aView.
dcd522133e4f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3507
diff changeset
   643
        text notNil ifTrue:[^ text].
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   644
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   645
    ^ text
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   646
!
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   647
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   648
helpTextFromView:aView at:aPointOrNil 
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   649
    "helper: ask aView for its helpText."
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   650
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   651
    |text|
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   652
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   653
    aPointOrNil notNil ifTrue:[
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   654
        (aView respondsTo:#helpTextAt:) ifTrue:[
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   655
            text := aView helpTextAt:aPointOrNil.
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   656
        ].
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   657
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   658
    text isNil ifTrue:[
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   659
        (aView respondsTo:#helpText) ifTrue:[
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   660
            text := aView helpText.
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   661
        ].
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   662
    ].
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   663
    ^ text.
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   664
! !
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   665
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   666
!ActiveHelp methodsFor:'private'!
1502
487b55dc68c2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   667
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   668
hideIfPointerLeft:aView
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   669
    "hide help, if the pointer is not in aView"
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   670
!
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   671
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   672
interestedIn:aView
1033
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   673
    "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
   674
     or in my list of apps)"
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   675
3347
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   676
    |app aViewsTopView device deviceFocusView|
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   677
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   678
    aView isNil ifTrue:[
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   679
        Debugging ifTrue:['nil view' infoPrintCR].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   680
        ^ false
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   681
    ].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   682
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   683
"/    applicationsOrTopViewsWithHelp isEmptyOrNil ifTrue:[
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   684
"/        Debugging ifTrue:['no apps' infoPrintCR].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   685
"/        ^ false
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   686
"/    ].
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   687
3347
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   688
    aViewsTopView := aView topView.
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   689
3348
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   690
    UserPreferences current onlyShowTooltipsForActiveWindow ifTrue:[
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   691
        aViewsTopView isActive ifFalse:[            
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   692
            Debugging ifTrue:[ 
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   693
                |graphicsDevice focusVw|
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   694
                
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   695
                'topview inactive' infoPrintCR.
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   696
                graphicsDevice := aViewsTopView graphicsDevice.
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   697
                graphicsDevice notNil ifTrue:[
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   698
                    focusVw := graphicsDevice focusView.
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   699
                    'focusView: ' infoPrint. focusVw infoPrintCR.
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   700
                    focusVw notNil ifTrue:[
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   701
                        'wGroup: ' infoPrint. focusVw windowGroup infoPrintCR.
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   702
                    ]
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   703
                ]
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   704
            ].
3417
6181a91c933a class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3395
diff changeset
   705
            ^ false
6181a91c933a class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3395
diff changeset
   706
        ].
6181a91c933a class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3395
diff changeset
   707
3348
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   708
        "/ if none of the view's components has focus...
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   709
        (device := aViewsTopView graphicsDevice) notNil ifTrue:[
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   710
            (deviceFocusView := device focusView) notNil ifTrue:[
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   711
                deviceFocusView topView ~~ aViewsTopView ifTrue:[
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   712
                    "/ 'for inactive ' infoPrint. aView infoPrintCR.
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   713
                    Debugging ifTrue:['inactive topView' infoPrintCR].
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   714
                    ^ false
b6e8252970c2 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3347
diff changeset
   715
                ].
3347
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   716
            ].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   717
        ].
f314814a3105 do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents: 3333
diff changeset
   718
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   719
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   720
    listeningForAll == true ifTrue:[^ true].
1033
3a56ba930052 care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   721
3395
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   722
    applicationsOrTopViewsWithHelp isNil ifTrue:[
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   723
        applicationsOrTopViewsWithHelp := WeakIdentitySet new.
e707e6cb12ed class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   724
    ].
1106
414b7cfe57b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   725
    (applicationsOrTopViewsWithHelp includesIdentical:aViewsTopView) ifTrue:[^ true].
414b7cfe57b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
   726
    app := aViewsTopView application.
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   727
    app isNil ifTrue:[
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   728
        Debugging ifTrue:['no app' infoPrintCR].
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   729
        ^ false.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   730
    ].
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   731
    (applicationsOrTopViewsWithHelp includesIdentical:app) ifTrue:[^ true].
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   732
    Debugging ifTrue:['not in list of apps I am interested in' infoPrintCR].
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   733
    ^ false
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   734
4134
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   735
    "Created: / 26-10-1997 / 23:28:52 / cg"
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   736
    "Modified: / 08-08-1998 / 13:36:19 / cg"
92df688b5ffe #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4123
diff changeset
   737
    "Modified: / 19-06-2018 / 12:58:39 / Claus Gittinger"
2782
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   738
!
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   739
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   740
targetViewInitiatesHelpViaSensor
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   741
    "true if the target view is asked to show the help via the sensor;
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   742
     false, if I do it myself synchronously."
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   743
79eb7b58118e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2779
diff changeset
   744
    ^ true
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   745
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   746
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   747
!ActiveHelp methodsFor:'queries'!
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   748
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   749
delayTime
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   750
    ^ self class delayTime
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   751
!
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   752
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   753
showTime
3333
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   754
    "how long shall the help be shown;
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   755
    0 means: forever (until user moves the mouse);
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   756
     >0 means that number of seconds"
66ff26772ee3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 3323
diff changeset
   757
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   758
    ^ self class showTime
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   759
! !
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   760
1768
7011c938442e method category rename
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
   761
!ActiveHelp methodsFor:'show & hide help'!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   762
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   763
hideHelp
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   764
    "hide the help text - nothing done here"
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   765
!
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   766
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   767
hideHelpIgnoringErrors
233
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   768
    "hide the help text"
196eb68b707c documentation
Claus Gittinger <cg@exept.de>
parents: 227
diff changeset
   769
1713
bc8a1d16e60f Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 1657
diff changeset
   770
    Error handle:[:ex |
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   771
        ex description infoPrintCR.
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   772
        ex return
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   773
    ] do:[
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   774
        self hideHelp.
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   775
    ].
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   776
!
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   777
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   778
initiateHelpFor:aView at:aPointOrNil
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   779
    "ask aView for helpText, passing x/y coordinates;
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   780
     start a timeout process to display this helpText after some delay;
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   781
     Normally used internally, but can also be used by widgets to force 
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   782
     re-negotiation of the displayed helpText 
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   783
     (for example in a menu, when the selection changes)"
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   784
4061
09d7c0183f51 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4060
diff changeset
   785
    "/ ActiveHelp stop
4060
9ddc9c4794f5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   786
    self class isActive ifFalse:[^ self].
9ddc9c4794f5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4058
diff changeset
   787
4058
d1ad98047781 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
   788
    "/ in standalone apps, it is better to simply not show the help
d1ad98047781 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
   789
    Error,BreakPointInterrupt handle:[:ex |
d1ad98047781 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
   790
        Smalltalk isStandAloneApp ifFalse:[ex reject].
d1ad98047781 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
   791
    ] do:[
d1ad98047781 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
   792
        self initiateHelpFor:aView at:aPointOrNil now:false
d1ad98047781 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4038
diff changeset
   793
    ].
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   794
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   795
    "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
   796
!
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   797
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   798
initiateHelpFor:aView at:aPointOrNil now:showItNow
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   799
    "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
   800
     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
   801
     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
   802
     re-negotiation of the displayed helpText 
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   803
     (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
   804
696
a49928754789 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 639
diff changeset
   805
    |text top app|
634
1d88f55984a2 comments
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
   806
1143
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   807
    (self interestedIn:aView) ifFalse:[
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   808
        ^ self
5706310407e9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   809
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   810
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   811
    text := self helpTextFor:aView at:aPointOrNil.
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   812
    lastHelpText = text ifTrue:[
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   813
        ^ self
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   814
    ].
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   815
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   816
    "/ let application show the help
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   817
    "/ (i.e. in its own information area)
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   818
    "/ nil-text is also passed down, to give it a chance
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   819
    "/ to clean its infoDisplay.
637
8be64da7d932 views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents: 636
diff changeset
   820
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   821
    top := aView topView.
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   822
    (app := aView application) notNil ifTrue:[
1019
862f095da4ac #showHelp:for: renamed to #showActiveHelp:for:
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
   823
        (app showActiveHelp:text for:aView) ifTrue:[
728
9f417e396d4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 726
diff changeset
   824
            lastHelpText := text.
632
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   825
        ]
844b1aaf3eeb provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents: 602
diff changeset
   826
    ].
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   827
!
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   828
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   829
stopHelpDisplayProcess
59
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   830
! !
98a4d38cfc96 Initial revision
claus
parents:
diff changeset
   831
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   832
!ActiveHelp methodsFor:'start & stop'!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   833
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   834
listenFor:anAppOrTopView
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   835
    "start listening"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   836
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   837
    applicationsOrTopViewsWithHelp isNil ifTrue:[
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   838
        applicationsOrTopViewsWithHelp := WeakIdentitySet new.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   839
    ].
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   840
    applicationsOrTopViewsWithHelp add:anAppOrTopView.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   841
    super listen.
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   842
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   843
    "Created: / 26.10.1997 / 23:20:47 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   844
    "Modified: / 26.10.1997 / 23:21:10 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   845
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   846
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   847
listenForAll
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   848
    "start listening"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   849
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   850
    listeningForAll := true.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   851
    super listen.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   852
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   853
    "Modified: / 28.6.1997 / 15:07:02 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   854
    "Created: / 26.10.1997 / 23:19:30 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   855
!
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   856
2391
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   857
start
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   858
    self listenForAll
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   859
!
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   860
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   861
stop
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   862
    self unlistenAll
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   863
!
f6af9239e999 reafctored
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   864
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   865
unlistenAll
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   866
    "stop listening"
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   867
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   868
    self hideHelp.
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   869
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   870
    listeningForAll := false.
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   871
    applicationsOrTopViewsWithHelp size == 0 ifTrue:[
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   872
        self unlisten.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   873
    ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   874
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   875
    "Created: / 26.10.1997 / 23:14:17 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   876
    "Modified: / 26.10.1997 / 23:23:04 / cg"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   877
!
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   878
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   879
unlistenFor:anApp
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   880
    "stop listening for an app"
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   881
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   882
    self hideHelp.
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   883
1543
95c5048dd99a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1541
diff changeset
   884
    applicationsOrTopViewsWithHelp isNil ifFalse:[
95c5048dd99a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1541
diff changeset
   885
        applicationsOrTopViewsWithHelp remove:anApp ifAbsent:nil.
95c5048dd99a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1541
diff changeset
   886
    ].
726
cdab756aebe4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   887
    listeningForAll == true ifFalse:[
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   888
        applicationsOrTopViewsWithHelp size == 0 ifTrue:[
1535
a9fcabccabb3 separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents: 1502
diff changeset
   889
            self unlisten.
719
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   890
        ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   891
    ]
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   892
17fba5c2a167 allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents: 696
diff changeset
   893
    "Created: / 26.10.1997 / 23:22:42 / cg"
726
cdab756aebe4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 719
diff changeset
   894
    "Modified: / 29.10.1997 / 15:48:34 / cg"
639
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   895
! !
0b1de8703593 fixed unlisten
Claus Gittinger <cg@exept.de>
parents: 638
diff changeset
   896
338
071f92621e3b oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   897
!ActiveHelp class methodsFor:'documentation'!
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   898
3665
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   899
version
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   900
    ^ '$Header$'
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   901
!
fd067a732096 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   902
2779
b608ded19ff2 changed: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   903
version_CVS
3507
Claus Gittinger <cg@exept.de>
parents: 3447
diff changeset
   904
    ^ '$Header$'
138
492fb73ca439 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   905
! !
3197
5924a1d75db3 class: ActiveHelp
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
   906
3320
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   907
602bf71b5fdc class: ActiveHelp
Stefan Vogel <sv@exept.de>
parents: 3292
diff changeset
   908
ActiveHelp initialize!