Unexpected value in the text box by setText() method, even though expected value by getText() method print in console - gettext

I am a newbie and currently working on a project to build a Netflix-like desktop app on NetBeans. Users can select movies from a list to watch. I have two basic classes one to get, and the other one to set.
ONE TO GET:
OTHER ONE TO SET:
When a user clicks on jButton2('named Izle' on picture), the name of the film and the 'episode no.' passes to the filmIzleniyor class constructor, and then the film starts.
jButton2 SCREEN:
There are two text field on that frame, one shows the name, other shows the 'episode no.'. The program objects have an id attribute, and 1-50 of id's are cinema movies, the others (greater than 50) are TV series. Cinema movies 'episode no.' is 1. If the user selects a TV series, he must enter the 'episode no.' in the box.
filmIzleniyor SCREEN:
The problem is that if user selects a cinema movie (so there's no need to enter the episode no.) everything is OK, but if he selects a TV series then both text boxes on the frame show the first entry all the time. I mean in every attempt after the first attempt both text boxes repeat the first.
As you can see on pictures, I have tried some controls to detect, but nothing.
Print the value taken by getText method in the console shows the true value, but wrong text is written on the frame.

I found a solution that way:
I call the filmIzleniyor(int x, String y) constructor by using new keyword in another button's actionPerformed method, it's the first time to call that constructor in the program. The second time to call, i use the new keyword again then it creates another instance, so that the contents of the text components are loading two times. İt shows the first content in the screen, i dont know why?.

Related

PowerApps Get Selected Item from Lookup to make a Button Visible at the Command line bar

I want a button from the command line bar to be visible or invisible depending on whether a record has been selected in the lookup field from the main form or not.
If no record has been selected, then the button should be displayed. Otherwise not.
For this problem, I want to use the Power Fx in PowerApps, but I haven't found a command yet, which shows me the content or something like that of the lookup field. Other field data types like text have worked without problems.
With Javascript, I already managed it without problems, but I would like to do it also in PowerFx if that should work.
Screenshot: https://i.stack.imgur.com/uqDJ6.png
The records come from the Table Company, where the attribute is Companyname.
Commands where I think they might work:
If([Selected Record];true;false);If(IsBlank([Selected Record]);true;false);If(IsBlankOrError([Selected Record]);true;false);If(IsEmpty([Selected Record]);true;false)
I guess there are 2 scenarios:
The Lookup form control element is a Dropdown with a Selected output property. Then your approach would work like If(IsBlankOrError(DataCardValue1.Selected),true,false)
If your form control element is a ComboBox then you could use If(CountRows(DataCardValue1.SelectedItems)>0,true,false) or the above described IsBlankOrError.

Unity Input field not setting value on change

I simply want to set a room name using input fields and the fact that it can pass the input through as an argument, but this does not seem to work for some reason.
here is the function that is called
here is the output in the console when typing in the field
why does it send in a blank string?
I followed this tutorial: Youtube
When you add a listener (HostGame.SetRoomName) you have two sections from which you can choose your functions: Dynamic string and Static Parameters. Your function should be in both sections:
Dynaic string - SetRoomName
Static Parameters - SetRoomName(string)
You have to choose the first one if you want to receive as parameter the input field text. The parameter in the second option is whatever you put in the field below HostGame.SetRoomName in your first image (in your case blank).
I worked around this by creating a reference to the text in "SetRoomName" it's not ideal but works
It hasn't been explained well but you want to select the top method under dynamic value. If you look at this image, you will see two methods, selecting the bottom (static) one will show the input field as you see but the top (dynamic) one (which is what you want) will show no input field.

How can I toggle a hidden element based on user input (text field)?

I'm looking for a good way to reveal a hidden element (a div) based on specific input into a form field. The application is an order form that isn't using any database. I want to have users input a coupon code and if it matches have the div appear (which contains what is needed to do the discount). And if it doesn't match it either does nothing, loads another hidden element or reveals a message like "invalid code".
PHP would be preferred but I'm open to anything. I don't see how the textbox where users enter the code has to be submitted with a submit button as it would submit the order form. It isn't critical that the discount is 100% secret. In other words, if they think to view the source code to see if they can figure out if there's a discount then they've earned it.
I've thought about using a inline frame for simplicity but I don't think that will work.
You could use the input's oninput function to watch the value entered. On each keypress you could make a call to see if it matches a coupon code. If the coupon codes are always "x" length, you could only do the call when the value reaches that length (if you don't want to call on every single keypress).
Alternatively, you could use a button and use it's onclick attribute. It would be the same idea as above, just instead of making the call on every keypress, you would only make the call on the button's click.
Once the value matches, just set the hidden div from "display: none" to "display: block" or something like that.
oninput reference
onclick reference

How to flag an invalid entry with CellRendererText

I'm writing an application with tables full of user-editable data. Some of the table columns contain numbers. I want the user to be able to type a new number in to a field in the table, but if the user types "foo" or "1.2.3" I need to be able to signal to the user that this has not been accepted.
When using a normal Entry widget I can set the state to Invalid if the user enters something that is not a number. However for the tables I'm using TreeView with TreeViewColumns. The user is editing text displayed with CellRendererText. I know that I can get the actual text entry widget while the user is entering text, but as far as I can tell when the user presses "Enter" that widget goes away before the CellRendererText sends the TextEdited signal.
What is the right way to signal to the user that they have typed in the wrong thing in this circumstance? I'd like to do something like outlining the offending field in red.
You can connect to editing-started to get the TextEntry object, and then connect to the changed signal to watch what the user is typing. After that you can hint a problem with the text.

GXT 3 spinnerField validation

I want to validate that user cannot change spinner value manually by typing in text box of spinner.
For example a field sales multiple = x which I fetched from server not fix.
and displays a spinner field with limitation of like bellow
spinner.setMinValue = x
spinner.setIncrement = x
spinner.setValue = x
so user forcefully select a value which is multiple with x. e.g. if x=3 the user have to enter 3,6,9... and so on.
So here my issue is if I type a 2 in spinner field text box. GXT widget accept that value.
Posible solutions:
Is there any predefined properties of spinnerfield that i forget to set it?
Is there any predefined validator for this?
Can I set text box of spinner field read only by css so user cannot focus on text box but still change a value.
If none of above how to achieve manually?
i've searched a bit in the different classes and I don't see either a precise method which would set what you want.
Don't know about one, and even with one, a validator doesn't change the value in the input field, but maybe it's enough for your needs.
You can disable the text input by calling setEditable(boolean) on the spinnerfield (testSpinner.setEditable(false);)
Maybe you could search around the IntegerPropertyEditor, I haven't tried but as long as a new Spinner is like this:
SpinnerField<Integer> testSpinner = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
you can seen that there is another Constructor for IntegerPropertyEditor, which takes a "NumberFormat" param, but there is no NumberFormart() constructor, so I'm not sure about how you create your own one, but that could be an idea (to format numbers in the input to be a multiple of the increment).
The last option would be that Sencha forgot this possibility and that you should report this as a "bug" on the forum ?
Hope to have helped a bit, good luck :).