ShowMeHowItWorks.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Jul 2019 08:00:52 +0200
changeset 3716 08e97653176e
parent 3715 8e37e3d91789
child 3717 26224649d91c
permissions -rw-r--r--
#BUGFIX by cg class: ShowMeHowItWorks added: #selectIndex:in: changed: #randomThankYou #selectIndex:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
     1
"{ Encoding: utf8 }"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
     2
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ Package: 'stx:libtool2' }"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"{ NameSpace: Smalltalk }"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
Object subclass:#ShowMeHowItWorks
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
     8
	instanceVariableNames:'application opStream lastComponentName lastComponent lastResult'
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
	classVariableNames:''
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
	poolDictionaries:''
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
	category:'Interface-Help'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
!ShowMeHowItWorks class methodsFor:'documentation'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
documentation
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    18
    automatic presentations.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    19
    To see how it works, open a methodFinder:
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    20
        MethodFinderWindow open
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    21
    and select its 'Show me how it works' item in the help menu.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
    [author:]
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
        Claus Gittinger
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
example
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    29
    MethodFinderWindow open.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    30
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
    ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
        ( showing: 'Choose the number of arguments' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
            select: '1' 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
        ))  
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
        (showing: 'Click into the "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
            click: ReceiverEditor 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
        (showing: 'Enter a value (or expression) into "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
        (showing: 'Click into the "first argument" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        (showing: 'Enter a value (or expression) into "receiver" field' do:(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
        ))
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
!ShowMeHowItWorks class methodsFor:'running'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
do:specArray
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    self doStream:specArray readStream
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    "Modified: / 19-07-2019 / 14:30:43 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
doStream:specStream
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    "must run as a separate process;
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
     otherwise - if started by the app itself -
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
     no events will be processed while running"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    67
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    68
    |appWhichStartedMe|
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    69
    
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    70
    appWhichStartedMe := WindowGroup activeMainApplication.
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    71
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    [
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    73
        self new 
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    74
            application:appWhichStartedMe;
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    75
            doStream:specStream
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    ] fork.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    "Created: / 19-07-2019 / 10:53:07 / Claus Gittinger"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    79
    "Modified: / 19-07-2019 / 16:44:02 / Claus Gittinger"
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    80
! !
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    81
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    82
!ShowMeHowItWorks methodsFor:'accessing'!
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    83
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    84
application:something
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
    85
    application := something.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
!ShowMeHowItWorks methodsFor:'commands'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    90
intro
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    91
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    92
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    93
    self tell:'you can stopp the shou - by pressing - the shiftkee'.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    94
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    95
    "Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    96
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    97
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
pause
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   101
    Dialog information:(self class classResources stringWithCRs:'Show Paused.\Click on "OK" to proceed')
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    "Created: / 19-07-2019 / 15:03:17 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   104
    "Modified: / 19-07-2019 / 16:13:33 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   107
show:message
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   108
    "showing (and speak) some message."
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   109
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   110
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   111
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   112
    self showing:message do:nil
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   113
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   114
    "Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   115
    "Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   116
!
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   117
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   118
show:message for:seconds
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   119
    "showing (and speak) some message and wait for some time."
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   120
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   121
    <action>
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   122
    
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   123
    self show:message.
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   124
    self wait:seconds.
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   125
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   126
    "Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   127
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   128
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   129
showing:message do:operationsOrNothing
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   130
    "execute operationsOrNothing while showing (and speaking) some message."
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   134
    |xLatedMessage messageView talkDone|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   136
    xLatedMessage := application notNil 
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   137
                        ifTrue:[application resources string:message]
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   138
                        ifFalse:[message].
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   139
                        
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   140
    self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   142
    messageView := ActiveHelpView for:xLatedMessage.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    "/ messageView shapeStyle:#cartoon.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    [
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   145
        messageView origin:(Screen current pointerPosition).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
        messageView realize.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
        self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
            talkDone := Semaphore new.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
            [
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   151
                self tell:xLatedMessage.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
                talkDone signal
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
            ] fork.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
            
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
            "/
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
            "/ allow speaker some headoff
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   157
            Delay waitForSeconds:(xLatedMessage size / 30).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
        ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   160
        operationsOrNothing notEmptyOrNil ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   161
            self doStream:(operationsOrNothing readStream).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   162
        ].
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    ] ensure:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
        messageView destroy
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
        talkDone wait.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    "Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   171
    "Modified: / 19-07-2019 / 21:37:07 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
wait:seconds
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    Delay waitForSeconds:seconds
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    "Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   182
!ShowMeHowItWorks methodsFor:'commands - checking'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   183
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   184
isEmpty:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   185
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   186
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   187
    |component|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   188
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   189
    component := self componentNamed:componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   190
    component isScrollWrapper ifTrue:[ component := component scrolledView ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   191
    component isTextView ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   192
        ^ component contents isEmptyOrNil
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   193
    ] ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   194
        self halt.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   195
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   196
    self error:'isEmpty: unhandled component type: ',component displayString.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   197
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   198
    "Created: / 19-07-2019 / 15:33:47 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   199
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   200
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   201
unless:query do:actions
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   202
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   203
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   204
    |result|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   205
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   206
    result := self doCommand:query.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   207
    result ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   208
        self doCommand:actions
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   209
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   210
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   211
    "Created: / 19-07-2019 / 15:33:32 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   212
! !
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   213
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   214
!ShowMeHowItWorks methodsFor:'commands - mouse & keyboard'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   215
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   216
click
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   217
    "press-release"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   218
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   219
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   220
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   221
    ^ self click:1 inComponent:lastComponent
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   222
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   223
    "Created: / 19-07-2019 / 16:11:03 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   224
!
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
click:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    "press-release"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   231
    self assert:(buttonNr isInteger).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   232
    ^ self click:buttonNr inComponent:lastComponent
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    "Created: / 19-07-2019 / 13:21:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   235
    "Modified: / 19-07-2019 / 16:10:19 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   238
clickIn:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   239
    "press-release"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   240
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   241
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   242
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   243
    ^ self click:1 inComponent:(self componentNamed:componentName)
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   244
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   245
    "Created: / 19-07-2019 / 16:09:58 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   246
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   247
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   248
fastMoveTo:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   249
    "move the mouse to componentName without circling"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   253
    |component|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   255
    component := self componentNamed:componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   256
    self movePointerToComponent:component.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   257
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   258
    "Created: / 19-07-2019 / 15:39:23 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
moveTo:componentName
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    "move the mouse to componentName,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
     then circle around it a few times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
    |component|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   269
    component := self componentNamed:componentName.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    self movePointerToComponent:component.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    self circlePointerAroundComponent:component.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
    "Created: / 19-07-2019 / 11:20:42 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   274
    "Modified: / 19-07-2019 / 15:38:11 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
select:itemsLabel
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    "select an item by label,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
     allowed after moving to:
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
        aComboBox
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
        aSelectionInListView
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    "    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
    |idx|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    (lastComponent isKindOf:ComboView) ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
        "/ click on the menubutton
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
        self movePointerToComponent:lastComponent menuButton.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
        self click:1 inComponent:lastComponent menuButton.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
        Delay waitForSeconds:0.3.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
        (idx := lastComponent list indexOf:itemsLabel ifAbsent:[nil]) isNil ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
            self error:'no such item in comboList: ',itemsLabel
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
        ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
        lastComponent select:idx.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
        Delay waitForSeconds:0.3.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
        lastComponent shownMenu notNil ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
            lastComponent shownMenu hide.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
    ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
    self error:'cannot select this component'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
    "Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
selectIndex:itemsIndex
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    "select an item by index,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
     allowed after moving to:
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
        aComboBox
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
        aSelectionInListView
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
    "    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
    <action>
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   318
    self selectIndex:itemsIndex in:lastComponent
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   319
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   320
    "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   321
    "Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   322
!
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   323
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   324
selectIndex:itemsIndex in:widgetArg
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   325
    "select an item by index,
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   326
     allowed after moving to:
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   327
        aComboBox
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   328
        aSelectionInListView
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   329
    "    
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   330
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   331
    <action>
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   332
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   333
    |widget y offset possibleWidgets|
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   334
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   335
    (widget := widgetArg) isScrollWrapper ifTrue:[
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   336
        widget := widget scrolledView
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   337
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   338
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   339
    (widget isKindOf:ComboView) ifTrue:[
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
        "/ click on the menubutton
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   341
        self movePointerToComponent:widget menuButton.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   342
        self click:1 inComponent:widget menuButton.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
        Delay waitForSeconds:0.5.
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   344
        widget select:itemsIndex.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
        Delay waitForSeconds:0.5.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
self halt.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    ].    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   349
    (widget isKindOf:SelectionInListView) ifTrue:[
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   350
        (widget isLineVisible:itemsIndex) ifFalse:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   351
            widget scrollToLine:itemsIndex
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   352
        ].    
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   353
        "/ click on the item
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   354
        y := widget yOfLine:itemsIndex.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   355
        offset := (widget width // 2) @ y.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   356
        self movePointerToComponent:widget offset:offset.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   357
        widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   358
        Delay waitForSeconds:(self clickTime).
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   359
        widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   360
        Delay waitForSeconds:0.5.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   361
        ^ self
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   362
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   363
    (widget isKindOf:SelectionInListModelView) ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   364
        (widget isLineVisible:itemsIndex) ifFalse:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   365
            widget scrollToLine:itemsIndex
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   366
        ].    
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   367
        y := widget yVisibleOfLine:itemsIndex.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   368
        offset := (widget width // 2) @ y.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   369
        self movePointerToComponent:widget offset:offset.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   370
        widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   371
        Delay waitForSeconds:(self clickTime).
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   372
        widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   373
        Delay waitForSeconds:0.5.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   374
        ^ self
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   375
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   376
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   377
    "/ none of it - see what is in there
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   378
    possibleWidgets := OrderedCollection new.
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   379
    widget allSubViewsDo:[:each |
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   380
        ((each isKindOf:ComboView) 
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   381
          or:[(each isKindOf:SelectionInListView)
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   382
          or:[(each isKindOf:SelectionInListModelView)
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   383
        ]]) ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   384
            possibleWidgets add:each
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   385
        ]
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   386
    ].
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   387
    possibleWidgets size == 1 ifTrue:[
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   388
        self selectIndex:itemsIndex in:(possibleWidgets first).
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   389
        ^ self
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   390
    ].    
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   391
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
    self error:'cannot select this component'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   394
    "Created: / 19-07-2019 / 21:59:15 / Claus Gittinger"
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   395
    "Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   396
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   397
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   398
type:aString
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   399
    "enter text into the last component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   400
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   401
    <action>
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   402
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   403
    lastComponent simulateTextInput:aString at:(lastComponent extent // 2) sendDisplayEvent:false
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   404
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   405
    "Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
!ShowMeHowItWorks methodsFor:'defaults'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
circlingCount
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
    "circle around move-end position that many times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
    ^ 3
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
    "Created: / 19-07-2019 / 13:03:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
circlingRadius 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
    "radius when circling"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
    ^ 30 "/ pixels
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
    "Created: / 19-07-2019 / 13:07:59 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
circlingSpeed 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
    "time per round when circling"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
    ^ 0.3 seconds.       "/ time per round
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
    "Created: / 19-07-2019 / 13:02:34 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
clickTime
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
    "when clicking"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   437
    ^ self shortClickTime
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    "Created: / 19-07-2019 / 13:17:20 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   440
    "Modified: / 19-07-2019 / 15:21:51 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   441
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   442
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   443
longClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   444
    "when clicking buttons"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   445
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   446
    ^ 500 milliseconds
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   447
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   448
    "Created: / 19-07-2019 / 15:21:42 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
pointerAnimationDelay
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
    ^ 50 milliseconds.   "/ 20 updates per second
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
    "Created: / 19-07-2019 / 13:04:45 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
pointerMoveSpeed
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
    ^ 400.   "/ pixels per second
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
    "Created: / 19-07-2019 / 13:05:40 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   463
shortClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   464
    "when clicking"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   465
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   466
    ^ 100 milliseconds
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   467
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   468
    "Created: / 19-07-2019 / 15:21:29 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   469
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   470
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
talking
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
    ^ true
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    "Created: / 19-07-2019 / 14:31:14 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
!ShowMeHowItWorks methodsFor:'helper'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   479
componentNamed:componentName
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   480
    "retrieve a component by name or report an error if not found"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   481
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   482
    |component|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   483
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   484
    lastComponentName := componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   485
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   486
    component := self findComponent:componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   487
    component isNil ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   488
        self error:'no component found for: ',componentName.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   489
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   490
    lastComponent := component.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   491
    ^ component
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   492
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   493
    "Created: / 19-07-2019 / 15:37:35 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   494
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   495
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
findComponent:componentName
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
    "find a component by name - in the active and possibly in any app"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
    
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   499
    |component candidates|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   501
    application notNil ifTrue:[ 
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   502
        component := self findComponent:componentName in:application.
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
    component isNil ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
        "/ search through all current applications
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
        candidates := OrderedCollection new.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
        WindowGroup scheduledWindowGroups do:[:eachWG |
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
            |eachApp|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
            (eachApp := eachWG application) notNil ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
                component := self findComponent:componentName in:eachApp.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
                component notNil ifTrue:[ 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
                    candidates add:component
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
                ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
            ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
        ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
        
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
        candidates size == 1 ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
            component := candidates first
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
        ] ifFalse:[    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
            candidates notEmpty ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
                self error:'multiple components found by name: ',componentName.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
            ]    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
    ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
    ^ component
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
    "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
3713
fa10e87dbf04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
   530
    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
findComponent:componentName in:anApplication
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
    |component componentNameSymbol foundByName foundByTitle foundByLabel|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
    (component := anApplication componentAt:componentName) notNil ifTrue:[^ component].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    (componentNameSymbol := componentName asSymbolIfInterned) notNil ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
        (component := anApplication componentAt:componentNameSymbol) notNil ifTrue:[^ component].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
    "/ mhmh - search through all widgets of anApplication; 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
    "/ maybe it was not created via the builder/spec,
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
    "/ or it has changed its name.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
    "/ look for: widget's name, widget's title, widget's label
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
    foundByName := OrderedCollection new. 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
    foundByTitle := OrderedCollection new. 
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    foundByLabel := OrderedCollection new.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
    anApplication window allSubViewsDo:[:each |
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
        [
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
            each name = componentName ifTrue:[ foundByName add:each ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
        ] on:MessageNotUnderstood do:[:ex | ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
        [
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
            each title = componentName ifTrue:[ foundByTitle add:each ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
        ] on:MessageNotUnderstood do:[:ex | ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
        [
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
            each label = componentName ifTrue:[ foundByLabel add:each ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
        ] on:MessageNotUnderstood do:[:ex | ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    foundByName notEmpty ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
        self assert:(foundByName size == 1) message:'multiple components found by name'.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
        ^ foundByName first.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
    foundByTitle notEmpty ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
        self assert:(foundByTitle size == 1) message:'multiple components found by title'.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
        ^ foundByTitle first.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
    foundByLabel notEmpty ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
        self assert:(foundByLabel size == 1) message:'multiple components found by label'.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
        ^ foundByLabel first.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
    ^ component
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
    "Created: / 19-07-2019 / 11:36:21 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   577
randomThankYou
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   578
    ^ #(
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   579
        'thank you, for watching'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   580
        'thank you for watching'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   581
        'thank you'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   582
        'have a good day'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   583
        'have fun'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   584
        'have fun with expecco'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   585
        'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   586
        'happy hacking'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   587
        'happy hacking, I hope you liked what you saw'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   588
        'hope you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   589
        'see you again'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   590
        'please give feedback, and let us know, if you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   591
        'if you have any questions, please contact exept'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   592
        'if you need more information, please take a look at the wiki'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   593
    ) atRandom
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   594
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   595
    "
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   596
     OperatingSystem speak:'have fun with expecco'
3716
08e97653176e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3715
diff changeset
   597
     OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin'
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   598
     OperatingSystem speak:'happy hacking, I hope you liked what you saw'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   599
     OperatingSystem speak:'please give feedback, and let us know, if you liked it'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   600
     OperatingSystem speak:'if you have any questions, please contact exept'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   601
     OperatingSystem speak:'if you need more information, please take a look at the wiki'
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   602
    "
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   603
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   604
    "Created: / 19-07-2019 / 21:39:18 / Claus Gittinger"
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   605
!
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   606
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
tell:message
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
    self talking ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
        OperatingSystem speak:message.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    "Created: / 19-07-2019 / 14:57:50 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
!ShowMeHowItWorks methodsFor:'helpers - broken'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
click:buttonNr atPosition:position
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
    "press-release at position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
    |screen|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
    screen setPointerPosition:position.    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
    self click:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
    "Created: / 19-07-2019 / 13:14:51 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
!ShowMeHowItWorks methodsFor:'helpers - mouse movement'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
circlePointerAroundComponent:component
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    "circle around it a few times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
    self circlePointerAroundPosition:(component screenBounds center rounded)
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
    "Created: / 19-07-2019 / 13:12:35 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
circlePointerAroundPosition:position
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
    "circle around it a few times"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
    |screen stepDelayTime numCircles circlingSpeed radius|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
    circlingSpeed := self circlingSpeed.    "/ time per round
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
    numCircles := self circlingCount.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
    stepDelayTime := self pointerAnimationDelay.   "/ update interval
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
    radius := self circlingRadius.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
    "/ move it around a few times
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
    1 to:numCircles do:[:round |
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
        |n angle|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
        n := circlingSpeed / stepDelayTime. "/ nr of steps per circle
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
        angle := 360 / n.                   "/ angle-delta per step
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
        1 to:n do:[:step |
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
            |a x y|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
            
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
            a := angle * step.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
            "/ clockwise starting above the center
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
            x := position x + (radius * a degreesToRadians sin).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
            y := position y + (radius * a degreesToRadians cos).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
"/ Transcript showCR:(x@y).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
            screen setPointerPosition:(x@y) rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
            screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
            Delay waitFor:stepDelayTime.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
        "/ and back
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
        screen setPointerPosition:position rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
        screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
        Delay waitFor:stepDelayTime.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
    "Created: / 19-07-2019 / 13:12:40 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
movePointerToComponent:aWidget
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
    "move the mouse to aWidget's center"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    self movePointerToPosition:(aWidget screenBounds center rounded).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
    "Created: / 19-07-2019 / 13:11:33 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   689
movePointerToComponent:aWidget offset:offset
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   690
    "move the mouse to position inside aWidget's"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   691
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   692
    self movePointerToPosition:(aWidget screenBounds origin + offset) rounded.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   693
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   694
    "Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   695
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   696
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
movePointerToPosition:newPosition
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
    "move the mouse to newPosition"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
    |screen distance start numSteps moveTime stepDelayTime delta|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
    start := screen pointerPosition.   
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
    distance := start dist:newPosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
    moveTime := (distance / self pointerMoveSpeed) seconds. "/ time to move
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
    stepDelayTime := self pointerAnimationDelay.            "/ update every 50ms
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
    numSteps := moveTime / stepDelayTime.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
    numSteps = 0 ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
        "/ already there
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
        ^ self
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
    delta := (newPosition - start) / numSteps.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
    1 to:numSteps do:[:step |
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
        |p|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
        
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
        p := (start + (delta * step)) rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
"/ Transcript showCR:p.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
        screen setPointerPosition:p.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
        screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
        Delay waitFor:stepDelayTime.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
    "Created: / 19-07-2019 / 12:57:30 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   727
! !
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   728
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   729
!ShowMeHowItWorks methodsFor:'menu actions - mouse buttons'!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   730
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   731
click:buttonNr inComponent:component
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   732
    "press-release in a component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   733
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   734
    |t|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   735
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   736
    t := self shortClickTime.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   737
    (component isKindOf:Button) ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   738
        t := self longClickTime
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   739
    ].    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   740
    self click:buttonNr inComponent:component clickTime:t
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   741
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   742
    "Created: / 19-07-2019 / 13:18:27 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   743
    "Modified: / 19-07-2019 / 15:22:47 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   744
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   745
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   746
click:buttonNr inComponent:component clickTime:clickTime 
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   747
    "press-release in a component"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   748
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   749
    component simulateButtonPress:buttonNr at:(component extent // 2) sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   750
    Delay waitForSeconds:clickTime.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   751
    component simulateButtonRelease:buttonNr at:(component extent // 2) sendDisplayEvent:false.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   752
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   753
"/    self click:buttonNr atPosition:(component extent // 2)
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   754
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   755
    "Created: / 19-07-2019 / 15:21:05 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
press:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
    "press at the current position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
    |position screen x y|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
    position := screen pointerPosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
    x := position x.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
    y := position y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
    self movePointerToPosition:position.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
    false "OperatingSystem isOSXlike" ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
        |osxPos|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
        osxPos := OperatingSystem getMousePosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
        x := osxPos x rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
        y := osxPos y rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
        OperatingSystem generateButtonEvent:buttonNr down:true x:x y:y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
        ^ self.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
    screen sendKeyOrButtonEvent:#buttonPress x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
    "Created: / 19-07-2019 / 13:52:38 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
release:buttonNr
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
    "press-release at the current position"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
    |position screen x y|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
    screen := Screen current.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
    position := screen pointerPosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
    x := position x.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
    y := position y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
    self movePointerToPosition:position.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
    false "OperatingSystem isOSXlike" ifTrue:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
        |osxPos|
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
        osxPos := OperatingSystem getMousePosition.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
        x := osxPos x rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
        y := osxPos y rounded.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
        OperatingSystem generateButtonEvent:buttonNr down:false x:x y:y.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
        ^ self.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
    screen sendKeyOrButtonEvent:#buttonRelease x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
    screen flush.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
    "Created: / 19-07-2019 / 13:53:05 / Claus Gittinger"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
!ShowMeHowItWorks methodsFor:'running'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   816
doCommand:op
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   817
    |numArgs sel args method|
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   818
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   819
    op isArray ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   820
        op first isArray ifTrue:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   821
            self doStream:op readStream.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   822
            ^ self.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   823
        ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   824
        
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   825
        "/ construct a selector from keyword parts at odd indices
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   826
        sel := ((op with:(1 to:op size) select:[:el :idx | idx odd]) asStringWith:'') asSymbol.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   827
        "/ construct arg vector from parts at even indices
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   828
        args := op with:(1 to:op size) select:[:el :idx | idx even].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   829
    ] ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   830
        sel := op.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   831
        numArgs := sel argumentCount.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   832
        args := opStream next:numArgs.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   833
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   834
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   835
    (self respondsTo:sel) ifFalse:[
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   836
        self error:'bad operation: ',sel
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   837
    ].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   838
    method := self class lookupMethodFor:sel.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   839
    (method hasAnnotation:#action) ifFalse:[self halt].
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   840
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   841
    lastResult := self perform:sel withArguments:args.
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   842
    ^ lastResult
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   843
    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   844
"<<END
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   845
     ShowMeHowItWorks do:#(
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   846
        showing: 'Choose the number of arguments'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   847
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   848
            moveTo: NumberOfArguments
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   849
            select: '1'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   850
        )    
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   851
        showing: 'Click into the "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   852
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   853
            moveTo: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   854
            click: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   855
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   856
        showing: 'Enter a value (or expression) into "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   857
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   858
            enter: '100'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   859
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   860
        showing: 'Click into the "first argument" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   861
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   862
            moveTo: Arg1Editor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   863
            click: ReceiverEditor
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   864
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   865
        showing: 'Enter a value (or expression) into "receiver" field'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   866
        do: (
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   867
            enter: '100'
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   868
        )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   869
     )
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   870
END"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   871
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   872
    "Created: / 19-07-2019 / 15:34:55 / Claus Gittinger"
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   873
!
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   874
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
doStream:specStream
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   876
    |previousStream resources|
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   878
    resources := self class classResources.
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   879
    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
    previousStream := opStream.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
    [
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
        opStream := specStream.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
        [opStream atEnd] whileFalse:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
            self nextCommand.
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
            Display shiftDown ifTrue:[
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   886
                self tell:(resources string:'you pressed the shift key, do you want to stop the show?').
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   887
                (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   888
                ifTrue:[
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   889
                    self tell:(resources string:'you stopped the show,').
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   890
                    self tell:(resources string:(self randomThankYou)).
3714
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   891
                    ^ AbortOperationRequest raise
d3314ff81424 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3713
diff changeset
   892
                ].    
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
            ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
        ].    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
    ] ensure:[
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
        opStream := previousStream
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
    ].
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
"<<END
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
     ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
        showing: 'Choose the number of arguments'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
            select: '1'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
        )    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
        showing: 'Click into the "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
        showing: 'Click into the "first argument" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
     )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
END"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
    "Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
3715
8e37e3d91789 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3714
diff changeset
   928
    "Modified: / 19-07-2019 / 21:41:43 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
nextCommand
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   932
    self doCommand:(opStream next).
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   933
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   934
"<<END
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   935
     ShowMeHowItWorks do:#(
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
        showing: 'Choose the number of arguments'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
            moveTo: NumberOfArguments
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
            select: '1'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
        )    
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
        showing: 'Click into the "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   942
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   943
            moveTo: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
        showing: 'Click into the "first argument" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
            moveTo: Arg1Editor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
            click: ReceiverEditor
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
        showing: 'Enter a value (or expression) into "receiver" field'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
        do: (
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
            enter: '100'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
        )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
     )
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
END"
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
    "Created: / 19-07-2019 / 10:54:04 / Claus Gittinger"
3711
a472042fd298 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   963
    "Modified: / 19-07-2019 / 15:35:15 / Claus Gittinger"
3700
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
!ShowMeHowItWorks class methodsFor:'documentation'!
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   968
version_CVS
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
    ^ '$Header$'
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
! !
34af8cf33242 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971