Merge pull request #242 from MikeTheWatchGuy/Dev-latest

Button clicks return key instead of button text if key is present
This commit is contained in:
MikeTheWatchGuy 2018-09-17 12:47:07 -04:00 committed by GitHub
commit 719d5dbd2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -901,6 +901,9 @@ class Button(Element):
def ButtonPressCallBack(self, parm):
r, c = self.Position
self.ParentForm.LastButtonClickedWasRealtime = True
if self.Key is not None:
self.ParentForm.LastButtonClicked = self.Key
else:
self.ParentForm.LastButtonClicked = self.ButtonText
# ------- Button Callback ------- #
@ -957,6 +960,9 @@ class Button(Element):
# first, get the results table built
# modify the Results table in the parent FlexForm object
r,c = self.Position
if self.Key is not None:
self.ParentForm.LastButtonClicked = self.Key
else:
self.ParentForm.LastButtonClicked = self.ButtonText
self.ParentForm.FormRemainedOpen = False
# if the form is tabbed, must collect all form's results and destroy all forms
@ -971,6 +977,9 @@ class Button(Element):
elif self.BType == BUTTON_TYPE_READ_FORM: # LEAVE THE WINDOW OPEN!! DO NOT CLOSE
# first, get the results table built
# modify the Results table in the parent FlexForm object
if self.Key is not None:
self.ParentForm.LastButtonClicked = self.Key
else:
self.ParentForm.LastButtonClicked = self.ButtonText
self.ParentForm.FormRemainedOpen = True
self.ParentForm.TKroot.quit() # kick the users out of the mainloop