B4J Question Can you directly edit a B4XPlusMinus control?

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Have a B4XPlusMinus that goes from 0 to 310. Wanting to set it to say 250... That takes holding down the arrow for a while and then its stops close tp the value I want.
Anyway, can you type in text? I know, Stupid question #59901 ;)
 

stevel05

Expert
Licensed User
Longtime User
Here's one I amended for myself, your welcome to try it and see if it does what you want or modify it as you like. It only works with B4j as that's all I needed at the time, and uses a TextField.
 

Attachments

  • SL_PlusMinus.zip
    5.5 KB · Views: 101
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Yesterday (or rather last night 🥴) I started fiddling to create a "wrapper class" (Erel style :)) to get that functionality.

It works, although I have two problems:

1 - in B4J the TextField I used is not the right width but in B4A it does (I will submit this question to Erel)

2 - I couldn't do the B4I part, again for the usual reason: I don't have B4I :( (because I don't have Apple sfuff 😁 - nor would I want to spend $ 99 every year to make Apple rich).
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
in B4J the TextField I used is not the right width
Have a look at the Base_Resize sub in the B4xPlusMinus class, the sizing is all done in there as it is possible to have different orientations for the B4xPlusMinus view. Add the sizing of the Textfield to that.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Have a look at the Base_Resize sub in the B4xPlusMinus class, the sizing is all done in there as it is possible to have different orientations for the B4xPlusMinus view. Add the sizing of the Textfield to that.
Thanks, Steve, but I don't want to modify the original class (nor make a modified copy of it by renaming it).

The goal would be to create a sort of wrapper, as Erel often does, for example with the many "versions" of CustomListView. He creates a class (or another custom view) to which he passes a CustomListView, to which to add functionality.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Then try adding a listener in your class that fires when the base pane is resized and resize the Textfield in there.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The project I am attaching (whose important part is the B4XPlusMinusEdt class) will surely have some defects, some corrections to make; also, the part for B4I is missing.

I haven't run many tests.


Note that this is for use with numeric values only; it makes no sense with a list of strings to be able to write the value directly.
[B4XPlusMinus can handle a list of strings too]
 

Attachments

  • B4XPlusMinusEditable.zip
    16.3 KB · Views: 90
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Thought sharing as well.
Have developed various special custom views, have called those widgets, to control digital creations (like LEGO, Tinkerforge, Arduino).
One of the custom view widgets is the WidgetPlusMinus.
It is based on the B4XPlusMinus and B4XDialogs InputTemplate.
NOTE: Not tested on B4A & B4i. Accepts positive whole numbers only. Validation check on input pattern and value in range.


1656438491721.png
1656438537245.png
 

Attachments

  • B4XWidgetPlusMinus.zip
    13.5 KB · Views: 83
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Thought sharing as well.
Have developed various special custom views, have called those widgets, to control digital creations (like LEGO, Tinkerforge, Arduino).
One of the custom view widgets is the WidgetPlusMinus.
It is based on the B4XPlusMinus and InputTemplate.
NOTE: Not tested on B4A & B4i. Accepts positive whole number only. Validation check on input pattern and value in range.


View attachment 130902View attachment 130903
After seeing that, I realized that I had not considered the possibility of the vertical setting, in the class that I have attached (project) to my previous post! 😁 :confused:

I will have to remedy.
 
Upvote 0
Top