29
29
// ===========================================================================
30
30
31
31
FXDEFMAP (GNEDialog) MFXDialogBoxMap[] = {
32
- FXMAPFUNC (SEL_COMMAND, MID_GNE_BUTTON_ACCEPT, GNEDialog::onCmdAccept),
33
- FXMAPFUNC (SEL_COMMAND, MID_GNE_BUTTON_CANCEL, GNEDialog::onCmdCancel),
34
- FXMAPFUNC (SEL_COMMAND, MID_GNE_BUTTON_RESET, GNEDialog::onCmdReset),
32
+ // interaction
33
+ FXMAPFUNC (SEL_KEYPRESS, 0 , GNEDialog::onKeyPress),
34
+ FXMAPFUNC (SEL_KEYRELEASE, 0 , GNEDialog::onKeyRelease),
35
+ // buttons
36
+ FXMAPFUNC (SEL_COMMAND, MID_GNE_BUTTON_ACCEPT, GNEDialog::onCmdAccept),
37
+ FXMAPFUNC (SEL_COMMAND, MID_GNE_BUTTON_CANCEL, GNEDialog::onCmdCancel),
38
+ FXMAPFUNC (SEL_COMMAND, MID_GNE_BUTTON_RESET, GNEDialog::onCmdReset),
35
39
// abort dialog
36
40
FXMAPFUNC (SEL_CLOSE, 0 , GNEDialog::onCmdAbort),
37
41
FXMAPFUNC (SEL_CHORE, MID_GNE_ABORT, GNEDialog::onCmdAbort),
@@ -147,6 +151,26 @@ GNEDialog::onCmdAbort(FXObject*, FXSelector, void*) {
147
151
}
148
152
149
153
154
+ long
155
+ GNEDialog::onKeyPress (FXObject* obj, FXSelector sel, void * ptr) {
156
+ if (myTesting && (obj != myApplicationWindow->getInternalTest ())) {
157
+ return 1 ;
158
+ } else {
159
+ return FXDialogBox::onKeyPress (obj, sel, ptr);
160
+ }
161
+ }
162
+
163
+
164
+ long
165
+ GNEDialog::onKeyRelease (FXObject* obj, FXSelector sel, void * ptr) {
166
+ if (myTesting && (obj != myApplicationWindow->getInternalTest ())) {
167
+ return 1 ;
168
+ } else {
169
+ return FXDialogBox::onKeyRelease (obj, sel, ptr);
170
+ }
171
+ }
172
+
173
+
150
174
void
151
175
GNEDialog::openDialog () {
152
176
// create dialog
@@ -155,12 +179,6 @@ GNEDialog::openDialog() {
155
179
myFocusButon->setFocus ();
156
180
// show in the center of app
157
181
show (PLACEMENT_OWNER);
158
- // continue depending of open type
159
- if (myOpenType == OpenType::MODAL) {
160
- // run modal dialog
161
- getApp ()->runModalFor (this );
162
- }
163
- /*
164
182
// continue depending on whether we are testing or not
165
183
if (myApplicationWindow->getInternalTest ()) {
166
184
myTesting = true ;
@@ -175,16 +193,19 @@ GNEDialog::openDialog() {
175
193
}
176
194
} else {
177
195
myTesting = false ;
178
- getApp()->runModalFor(this);
196
+ // continue depending on the dialog type
197
+ if (myOpenType == OpenType::MODAL) {
198
+ // run modal dialog
199
+ getApp ()->runModalFor (this );
200
+ }
179
201
}
180
- */
181
202
}
182
203
183
204
184
205
long
185
206
GNEDialog::closeDialogAccepting () {
186
207
// check if stopping modal dialog
187
- if (myOpenType == OpenType::MODAL) {
208
+ if (!myTesting && ( myOpenType == OpenType::MODAL) ) {
188
209
getApp ()->stopModal (this , TRUE );
189
210
}
190
211
// hide dialog
@@ -198,7 +219,7 @@ GNEDialog::closeDialogAccepting() {
198
219
long
199
220
GNEDialog::closeDialogCanceling () {
200
221
// check if stopping modal dialog
201
- if (myOpenType == OpenType::MODAL) {
222
+ if (!myTesting && ( myOpenType == OpenType::MODAL) ) {
202
223
getApp ()->stopModal (this , TRUE );
203
224
}
204
225
// hide dialog
0 commit comments