Accessing forms created through LWUIT resource editor using code - lwuit

I am trying to develop a quiz application using LWUIT resource editor and am having great difficulty.
I have created two Forms 'GUI1' and 'GUI2' .
GUI1 displays the following:
A question(in the form of a TextField)
5 RadioButtons belonging to the same group
A Button which says 'OK'
GUI2 displays the following:
A TextField
A Button to go back to GUI1
Now the problem is:
Initially GUI1 is displayed. When the user chooses a RadioButton , I wish to know which RadioButton was selected. If that RadioButton was indeed the correct answer, then when the user clicks on the 'OK' Button on GUI1, I wish to display the text 'correct' in the TextField on GUI2 and then display the GUI2.
If the user chose the wrong answer, then I wish to display the text "Wrong" in the TextField on GUI2 and then display the GUI2.
How can this be done with resource editor? I am very foxed. Please help.
I wish to refer to the TextField on GUI2 when I am currently on GUI1. How can this be done with resource editor? Writing a manual code for all this would be very time consuming.

Ok I will try to explain the best I can.
When you design the first Form GUI1 the five RadioButtons must be in the same group. I don't know how to do that in the resource editor (I think there is a field called ButtonGroup in the RadioButton, but I can't remeber). What I would do is take the five RadioButton by code in the before method of GUI1 and add them to a ButtonGroup element.
With ButtonGroup you can know which element is selected using ButtonGroup.setSelectedIndex(). When you press the Button take this value and act as appropriate to the situation.
If you don't understand anything please tell me and I will try to help you.
Is not a hard thing to do. There must be a way to do it with the Resoruce editor but at the moment I donĀ“t know how.

As Shai mentioned, the best thing to do is to use listeners to set the "state" of the buttons on clicking them and when you move to the next form you just retrieve the state of the previous text field.
Manual code may actually be faster for you, do most of the UI in the resource editor and transfer to a form that is written manually. That way you have full control over your objects and transfer back into the GUI builder form when needed.

Related

MS Access Form Development: Hide Objects when an Option Button is Pressed without coding for each Object that needs to be hidden

MS Access Development Question:
I have 3 options and I need each one associated with a different set of objects. Therefore, if you click option 1, a set of objects will appear in a box I'm referring to as "Report Parameters". If I click option 2, the objects in the "Report Parameters" box will disappear and a new set of objects will appear.
I didn't want to write code to switch each object from visible = true to visible = false. I thought that would take too long, especially if the number of option buttons or the objects related to it grow.
So I'm trying several things...
I tried putting all objects, that relate to a particular option, in a Subform. Therefore, I would have three subforms and that would sit in the same position on my main form. When you click on an option, the subform for that option is made visible any anything else is hidden. But I have a background picture that needs to be visible on the main form and you can't make the subform background transparent.
I used Tab Controls; however, I didn't want to use the tabs to control the switch between objects. I can hide the tabs but you can still switch between them if you click the space where the tab should be. It can be made transparent though so that helps a lot.
I need something in-between a Subform and Tab Control but I've hit a dead end. Does anyone have any other suggestions or recommendations? Or am I stuck coding for each object?
I'm an experienced VBA developer. My last option was to run a query against the form and pull all object names and save it to a table. Since the syntax of the name for each object connects it to a button, I can always run a loop that makes all objects visible/invisible if the object's name corresponds with a specific option... but... I guess I'm trying to find a shortcut. Let me know what you think! Thanks.
I was able to resolve my issue. I just needed to do some thinking... so writing up this question was a bit premature. I'll write down what I did in the event that someone has the same issue I have.
First, I used the Tab Control object to resolve my issue. I made the control transparent and named each page to reflect the Option Button I was selecting.
I then mapped each option to a button in the VBA code of the button. Therefore, when the button is selected it does several things.
First, it makes the default value of any of the other options equal to false. I also set the visibility of their corresponding pages to false.
Second, I select the page I need visible and set the visibility to true. I also make it my active page.
Lastly, as a safety measure, if the option button is already selected, and you select it again, by setting the value of that option to true. This is to prevent it from changing to false. One option should always be selected.
Hope that all made sense!

GWT eventhandler specifics

I am making a simple webui in gwt and I want to implement the following functionality: once the user clicks a checkbox, a new text area with some wording appears. When the user unchecks the textbox, the textarea disappears. Can anyone show me the implementation on how to do this?
The CheckBox has a ValueChangeHander < Boolean >. You can use this to get the actual value, after the change.
There is also an example to get the value within the clickhandler.
http://www.gwtproject.org/javadoc/latest/com/google/gwt/event/logical/shared/HasValueChangeHandlers.html

Why does my access form lose focus

I have a Microsoft Access form which I use for entering client information:
First name
Last name
etc..
My problem is when I tab away from the Access Form to view the information which needs to be entered, the focus is lost in access. I need to click the form with the mouse to regain the focus.
This is very annoying!
Any help here?
AS far as I know, the focus of an access object is lost when you clic anything outside the object... that includes forms.
I can suggest you two ways of tacling this:
Use a control (combo box or list box) inside your form, so you can view the data you need.
Use a "pop up" form: you can create a form with the data you need, and a button inside your main form that opens this "pop up" form. You can specify in VBA if you want your form to open as a pop-up... if I remeber correctly, is something like this:
...
docmd.openform("frmYourForm",,,acDialog)
...
Hope this helps you

How can I change the whole structure of a form by clicking a button ( Visual C# Express 2010 )

I'm new here as I am programming with Visual C# Express 2010.
Thats the case:
I have the first form, it contains labels, buttons, textboxes etc. I want one of these buttons to change all the aspects of this first form in order to create a second one.
An example of what I want is an ordinary installer program. It has one form ( I think ). And we have "next" button. Clicking on it, the whole form structure will change.
PS: Im not making an installer program.
Thank you!
It might be easier simply to develop a new form, and have the button launch an instance of that new form.
That said, you can programatically change aspect of GUI elements by using the appropriate properties.
For example, suppose you have a label lblStatus somewhere on the form. You can change its location and text with the following lines:
lblStatus.Location = new Point(20, 0);
lblStatus.Text = "Updated Status";
Hopefully this is helpful to get you on the right track.
You could do multiple things:
Use tab pages for each page of things that you want. Add a button outside of the tabs that will change to the next one.
Add a button and a panel on the form. Each page of the form is a different UserControl. When you click the button, fill the panel with a new instance of the UserControl that you want.
Do something like this: http://www.codeproject.com/KB/miscctrl/DesignTimeWizard.aspx
Or this: http://visualstudiogallery.msdn.microsoft.com/en-us/c2c412fd-bd28-4e3b-9c20-4dc381ac5199

MS Access 2003 - Simple value input into a text box from clicking label boxes

Ok so could anyone please help me out with the VB for auto entering information into a text box, by clicking certian label boxes on a form in access 2003.
I built this thing using label boxes as "sort of links" instead of button for navigation/commands etc, and I have this power point presentation viewer on one of the forms.
The client has numerous briefings and this will be great for me to provide a little something for them to be able to get their briefings from one spot.
So if I list the choices for the month out on the form as label boxes (with little mouse move events to resemble a web link) and they click on it to select, then the only way I know how this may become functional is if I add a text box to the form, and make it not visible, that way I can name it, and add it to the file path string and it works.
But how do I create the action of clicking the "link" result in "NVOWEFDJHF" into text box?
Anyone know a better way?
Yeah I am an amateur, so I am ALWAYS willing to learn a better way.
Thanks very much!
I would recommend using a transparent button instead of a label.
The main reason is that you can set the mouse cursor to become a small hand when you hover over the button, so it gives back information to the user that this can be clicked.
With a label, the user cannot make the difference between a normal label and one that can be clicked since there is no visual cue.
To create a button that resemble a label:
Add the button to the form
In the properties for the button, set the following:
Format > Back-Style: Transparent
Other > Cursor on Hover: Hyperlink Hand
Other > Name: btAutoFill (or whatever name you want)
If you want the button to resemble a link a bit more, you can change it's caption's format, making it blue and underlined if you wish.
Now if you view the form, you will see that the mouse cursor will change when you move over the 'button label'.
To automatically fill-in other controls when you click your button, add the code to handle its OnClick event (in the button's properties, under Events > On Click, choose [Event Procedure]):
Public Sub btAutoFill_Click()
myTextBox = "NVOWEFDJHF"
End Sub
Quick air code here...
Private Sub MyLabel_OnClick()
Me.MyTextBox = "NVOWEGDJHF"
End Sub
Don't forget your error handling.
You're making this as difficult as possible by using an approach that is not Access-native. The simplest way to make the labels "clickable" is to put a transparent command button over them. But that means the MouseMove events will go to the command button, so you'll have to have its events do the MouseOver actions.