I have a form designed with the GUI designer with input textfields and buttons. I have attached actions to the buttons. When I call up the form with showForm(Form,null), the textfields are not accepting input and the buttons are not triggering the action. This is happening only for this form. Initially, there was the problem solved here Unable to call a specific form from a button in codenameone and then the problem solved here Simulator keeps defaulting to old Main form. What could be the issue now?
As far as I know there may be some issues as you say, but first need to see code
In the form after you added the text fields did you select the text field component and press action event?
Assuming you did that you should get a callback method in the Statemachine class.
This call will be invoked only when the user changes the content of the text field. You can run in the debugger and set breakpoints/step into code to see what is going on.
Related
in my app, when editing a record, I've added an ActionListener to save a temporary copy of the edited values for each field automatically, so that if the app is put in the background and then stopped, the edited values can be recovered when the app is started up again.
However, with the TextAreas it doesn't work since actionListeners don't get called unless the user takes some action (like leaving the field). I need to use the TextArea since there can be multiple lines of text, so using a DataChangedListener for a TextField as suggested in this thread does not seem a viable solution. And being able to save the TextAreas is important to achieve good UX since the user likely loses more work when text is dropped than if for example a value set in a Picker is lost.
Is there another way to achieve this result?
Thanks in advance
TextField allows multiple lines using setSingleLineTextArea(false). When invoked it will function similarly to TextArea.
In a test-class, is there any way to invoke Buttons inside the toolbar, without a name (""), which were added like this?
getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_PICTURE_AS_PDF, e -> createPDF());
Or can I somehow tell the test-class to show a specific form ?(which is happening when I click the button without a label).
The test recorder is not generating any code in that case. It seems that it is only working with buttons, which have a non-empty String as name, as they are simply invoked by
clickButtonByLabel("Label");
The test recorder was written before the Toolbar existed, we tried to update it for the Toolbar recently but this proved to be pretty difficult.
We have this issue that covers this bug. As a workaround you can post the command directly in the code of the test.
Using CodenameOne,
I have a Form that the user needs to fill in. All of the components, however, are actually Containers that represent custom functionality. As an example, I would have a TextField alongside a Button on a Container, and I would use that Container as a "Component". This allows me to create more advanced functionality by combining existing Components.
A good example of where this is necessary is that of a custom date entry field existing out of 3 TextFields or a combination of TextFields and ComboBoxes.
I have a "Field" that has functionality for that of a Contact Component.
This all serves as a single "Unit" in order to allow the user to choose a contact or fill in their own. Buttons open Dialog popups, etc.
My problems comes with when the user uses the Android keyboard. Should this Contact Object be the second "Field" and the user presses the 'Next' button on the Android keyboard, the App does not know what field to give focus.
Furthermore, If one of the fields are a ComboBox or a Button and the user presses next to reach that Component, the keyboard doesn't close, and instead removes the 'Next' button, replacing it with a return button or an emoticon selector.
Below is an example situation:
The user would press on the first field, the Keyboard shows up, and when the user presses next, the keyboard's Next button dissapears, as the immediate next field happens to be a Button or ComboBox.
Is there a way to change the focusing index, or omit certain fields form ever gaining focus in this way? I tried making the entire thing a Component but that doesnt allow me to combine other Components. Even if it is possible to make the parent Container a Component, how would I solve this particular issue?
The default behavior is to use the "next focus down" for this functionality so just use setNextFocusDown(nextTextField) on each one of the components. Notice that a ComboBox won't work as expected although you might want to change that to an AutoCompleteTextField which would.
Is there any way to know the current value of a checkbox in wicket before any action takes place?
wantOnSelectionChangedNotifications() is not useful for me, I want to know the value of the checkbox before clicking on it.
Thanks
first of all in the server you cannot know the state of the input with out a form.
use AjaxFormComponentUpdatingBehavior or AjaxFormSubmitBehavior to attach the event to the checkbox and submit their form. with this aproach you going to submit all components inside the form, if you just want the value of the check you could use a nested form(wicket include support for it)
In my application I call App.Current.MainWindow.Show()/App.Current.MainWindow.Hide() to show/hide my application but I don't know how to catch the event when the form is hidden/showed. Please help if you know how to!
One of your tags is WPF and the other is WinForms... I'm better with WinForms, so I'll answer for that tag.
The Form.Shown event documentation is here with sample code...
There is no corresponding Form.Hidden event. The best you can do is choose from Form.Closing or Form.Closed or one of the other events.
Added from my comment above
Question - if you're CALLING the Hide and Show in your code, why do you need to capture the events? You already KNOW when it's happening. If you want to run some code inside the form after hiding and closing it, expose the code as a public function, and call the function after showing and hiding the form...