G4P, extend control class?

I haven’t found any further problems with GControlPalette, all good thank you :+1:

The Numeric input field does seem to be more complex than I had originally thought.
I think your solution of option 2 may be the best for GControl.

That said, maybe I should try and better describe how I would use such a control and how I’m using my simple hacked up version.

  • No scientific number notation, I have never had to put this notation style in a UI and I haven’t used a UI other than a calculator that implemented it…I’m not really sure how often this notation style is likely to be used ?

  • The control does not need to do maths itself i.e no addition or subtraction calculated whilst inputting numbers… so no need for ‘+’.

  • The controls min and max values are defined at initialisation.

  • Integer or decimal defined at initialisation.

  • The number input field is a square divided into 3 rows, the middle row is the number display area, the top row and lower row are each for a label (see image attached).
    numFieldGrab

  • If the cursor is anywhere over the input field the user may scroll the mouse wheel to increment/decrement the current value.
    My reason for wanting scroll input is that if you have UI that is mostly selecting objects, pressing buttons, dragging sliders,etc… then you come to a number field that only takes key input you probably have to take your hand off the mouse to type, then go back to the mouse to move onto the next button/field…all this chopping/changing slows things down.

  • My bodged version currenlty ignores anything that is not a number;
    if (keyChar >= '0' && keyChar <= '9') { }

The one thing I haven’t done is find a way to deal with keyed input of ‘-’ for negative numbers, that’s just because I haven’t needed to use them as 95% of the UI’s I make are for controlling external hardware that does not take a negative number as an input.

I’m not sure if any of the above helps at all, but hopefully you can see how I would use such a control :grinning:

1 Like

Thanks for the information it is useful to know where you are coming from. We might have been talking at cross purposes, what you are describing is a spinner control that accepts input via keyboard and/or mouse and possibly mouse wheel.

Image showing 3 spinners
spinner

and I was thinking in terms of a GTextField that accepts numeric input. :grinning:

1 Like

You could create this from two GLabels and a spinner control.

I will think about the requirements specification and come back to you, but if you have any others thoughts before then just post them here. :smile:

1 Like

Ah yes, a spinner with scrollwheel inc/dec ability, key input and 2 labels would do it! :grin:
Sorry for the confusion.

1 Like

This is a very long discussion so I have created a new topic to try and get some feedback on the new controls.

1 Like