dMZX Forums: Backspacing a one-digit number in dialog window -> Archived MegaZeux Bugs -> Tracker

Jump to content

Report ID 445 Title Backspacing a one-digit number in dialog window
Product Archived MegaZeux Bugs Status Fixed (Severity 1 - Low)
Version GIT Fixed in 2.84
Introduced In Version ----Operating System Windows XP SP2

Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Report ID #445: Backspacing a one-digit number in dialog window

#1 User is online  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,943
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 17 May 2012 - 02:10 AM

While backspacing a one-digit number in a dialog window should and does revert the number to its minimum value, when you type the next value and the minimum value is greater than zero it pushes the minimum value upward in significance instead of discarding it (I hope that made sense). For example, if the Board Width is at "1" and you type "80" you end up with "180". Ideally, this wouldn't happen: it would be kept track of with a "digit" boolean at the parent window level that would make sure the minimum value gets overwritten if the least significant digit is deleted -- this could be shown as the number being blank until focus is changed and the digit boolean reset. Tell me if I'm wrong, but I doubt this would be incredibly difficult to implement.

Rules:
  • When focus changes, the boolean is always set to False.
  • Backspace on a 1 digit number reverts to minimum value and sets the boolean to True. No number is displayed when it's True, but it is still internally kept at the minimum value.
  • When the number overflows, the boolean is left False.
  • Control Changes when the boolean is True:
    • Any key press besides Backspace sets the boolean back to False after it has been executed. Backspace is otherwise ignored.
    • Pressing any number sets the first digit to that number, as if it was equal to 0.
    • Page Up sets the number to 100 and Shift+Up sets the number to 10, as if it was equal to 0.
    • Up, Down, Shift+Down, and Page Down leave the number at the minimum value.
    • Home and End are unchanged.


Multi-digit minimum values would throw a huge wrench into this but I think they'd throw a wrench into the way it works in general already, and I don't know of any off the top of my head.

As you've probably noticed, this is Part of a Series On: Dialog Windows

Looks like I'm 4 freaking years late
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository


Page 1 of 1  
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Replies (1 - 6)

#2 User is online  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,943
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 17 May 2012 - 04:46 AM

Updating status to: Confirmed
Updating severity to: 1 - Low

Fixed. Here's the relevant diffs:

diff mzxgit-20120516/src//window.c mzxgit-20120516-lachesis/src//window.c
1029c1029,1032
<     sprintf(num_buffer, "%d", *(src->result) * increment);
---
>     if (!src->is_null)
>       sprintf(num_buffer, "%d", *(src->result) * increment);
>     else
>       sprintf(num_buffer, " ");
1253a1257
>       if (src->is_null) increment_value -= src->lower_limit;
1260a1265,1267
>       if (src->is_null)
>         increment_value -= src->lower_limit;
> 
1289c1296,1297
<       if(result < src->lower_limit)
---
>       if(result == 0 || result < src->lower_limit)
>       {
1290a1299,1300
>         src->is_null = 1;
>       }
1301c1311
<         if(current_value == src->upper_limit)
---
>         if(current_value == src->upper_limit || src->is_null)
1323a1334,1339
>       if (key != IKEY_BACKSPACE &&
>        !get_shift_status(keycode_internal) &&
>        !get_ctrl_status(keycode_internal) &&
>        !get_alt_status(keycode_internal))
>         src->is_null = 0;
> 
1327a1344,1345
>   src->is_null = 0;
>
1821a1840
>   src->is_null = 0;
diff mzxgit-20120516/src//window.h mzxgit-20120516-lachesis/src//window.h
167a168
>   int is_null;

"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#3 User is online  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,943
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 17 May 2012 - 05:06 AM

Okay, not that anybody actually CARES about the number lines, but that makes Backspace act weird when using them. Fix:

    case IKEY_BACKSPACE:
    ...
      result = src->lower_limit;
      if (src->upper_limit > 9)
        src->is_null = 1;
    ...


The two "increment_value -= src->lower_limit;" bits can be consolidated to a single check after the switch closes with an added (increment > 0) condition. That'd be cleaner.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#4 User is online  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,943
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 17 May 2012 - 05:19 AM

Updating status to: Proposed Fix
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#5 User is online  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,943
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 17 May 2012 - 07:32 PM

Updating version to: GIT

Issue fixed in: 2.84


Fixed in my fork.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#6 User is online  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,943
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 24 May 2012 - 12:59 AM

Updating status to: Fixed
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#7 User is offline  
Terryn 

  • ******
  • Group: DigiStaff
  • Posts: 2,966
  • Joined: 12-October 00
  • Gender:Male

Posted 27 May 2012 - 07:29 PM

Moving to: Archived MegaZeux Bugs


Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

1 User(s) are reading this issue
1 Guests and 0 Anonymous Users


Powered by IP.Tracker 1.3.2 © 2025  IPS, Inc.