Okay, here is my first Xojo questions. I am trying to move a Windows VB.net program to Xojo and ran into a problem with the user interface. Xojo does’t show me a spinner object that can be used to increment/decrement a value.
I wanted to attach a picture of what I am trying to do, but I don’t see a way to attach an image that is on my iMac. Images appear only to be available via url.
In the following image you can see the UI I was developing in Netbeans. The “Zone Duration” selectors are what I am talking about. In Netbeans they are called spinners, in VB.net they are called Numeric UP Down counters. Dave understood what I am looking for.
Apparently in Xojo They are called steppers.
Now to figure out how to combine a numeric field/textbox and a steppper so that I can have numeric values that step up or down with a lower limit of zero and an upper limit of 60 and a step of 1.
Okay, I placed a label in the window and then placed an up/down arrow to the left of it. I added event handlers for the up and down events that increment and decrement the label value. I also had to add a check for numeric and implement limits for the low and the high permitted values. I now have to duplicate that work 6 times for the other zone controls. I also have to be careful to position them as a pair to avoid fudging the appearance. The biggest problem is that copying the two controls does not update the event handlers so all the copied handlers update the first value and must be individually edited to point to the correct value.
While this works okay, this is all very tedious. A combined up down numeric counter would be a nice addition to the picker control set. A numeric up down counter is a very common UI element and it would avoid a number of problems:
1: You could place the control and the text field in one step
2: The arrows and text field would already be perfectly aligned and positioning would not disrupt the alignment.
3: The arrows would automatically update the control’s text field without having to code the updates.
4: The numeric check could be built in.
5: There would be no need for the up or down event handlers as those would be built-in
6: The limits, the default starting value, as well as the step amount could be set in the control properties or programatically.
6: Placing dozens of numeric step controls would be a breeze with no coding work
Thanks Michel, that helps with alignment of the arrows and label value, but all the other concerns remain. You still need to go in and manually update the value being modified on each copy and the numeric value check as well. Any simplification of that work?
I think what is going on here is the original control that is created should be a class. Then each instance would not require any editing.
The way I am currently doing this is to create the original control in the designer with a label, an up/down arrow, and a group. I set up the events and then once it is working, I simply copy it in the design window. Doing it that way requires me to edit all the actions in the copies.
Dave, that is a generous offer, thank you. The problem I have is not so much how to write it, but how to do it in Xojo’s environment. I am clearly lost as to where things go and how this is all organized. It is clear this cannot be done in the GUI design window and then copied from there, so where should it be written (what file)? Where should it be instantiated? Are you talking about somehow creating a a custom control that becomes part of the available controls in the picker group or something else?
but yes it can… and yes that is how you do it[quote=384007:@Mike Gauthier]Are you talking about somehow creating a a custom control that becomes part of the available controls in the picker group [/quote]
that is exactly right, you can then drag as many instances or as few as are required… they act just like any other control that comes pre-installed with Xojo
As a matter of fact I have it already complete… but seem to have run across an anomoly with the Label control…
I watched a video on how to make a new control that only included 1 control and adding actions. They were a URL label and a Calendar. I successfully made both of them.
There is nothing I could find on how to combine controls so I simply tried what is in the attached image. And that doesn’t work. Whatever way I try, I end up with 3 separate controls, not a combined control.
The steps I took are in the image and the result is in the left column.
I can combine the controls okay in the window, but I still don’t see how to combine these into one subclassed control.