How to flag an invalid entry with CellRendererText - gtk3

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.

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.

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

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?.

How to clear a SAPUI5 input field with only value help input allowed?

my SAPUI5 app has an input field where the valid values must be obtained through a value help:
<Input showValueHelp="true" valueHelpOnly="true"
valueHelpRequest="onValueHelpRequest"
value="{myModel>/myField}"
The value help is realized with a SelectDialog, where the only options are
choose one or
cancel
The problem is now the following flow:
User opens value help dialog to choose one item and presses Confirm
Input field now displays chosen value
User wants to clear the input, because it's optional
Unfortunately,
sap.m.Input doesn't provide a clear button
sap.m.SelectDialog doesn't provide the possibility to add a custom button like Clear
The input is layed out in a SimpleForm with 2 columns, labels and input fields, so it would be hard to add a clear button
The Gateway entity set which feeds the value help dialog list doesn't have a totally empty line
I don't like the workaround to switch the SelectDialog to multiSelect just for the purpose that the user can choose "one or none". I also think it would be hard to explain to the user "if you want to remove the value, hold the control key and click on the previously selected item again".
Any ideas out there how to easily implement a clear button or something similar?
valueHelpOnly="false"
// with this user can either fill by F4 (assisted input) or by typing input..
and if you want to clear you can add a button and set the value to null
oInput.setValue("");

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 :).

VBA form to show cell value

I have an Excel VBA form to enter data into a worksheet.
Last column of my worksheet CC contains a formula which calculates some input fields. It is a very long though simple formula.
Is it possible that while I am entering the data in the form, a field in the VBA form itself keeps showing me running result of the inputs made based on the formula in the worksheet column CC?
I don’t know how to write that long formula in VBA so want to find out if there is a way around it.
If not possible, how about while the data has been entered in the form, there is a button CHECK RESULT. Clicking this button temporarily enters the form data to spreadsheet, populating CC cell and that result shows up as message box while the VBA data form is still open.
This result message box could have two buttons, CONFIRM ENTRY or CANCEL.
If cancel is clicked then the data entered in the spreadsheet is deleted. If confirm is clicked, then entered data stays.
Kind of urgent if someone can suggest a solution.
I have added image of my VBA form.
In the most basic manner to answer your sub question:
"Is it possible that while I am entering the data in the form, a field in the VBA form itself keeps showing me running result of the inputs made based on the formula in the worksheet column CC?"
Yes it's possible.
Asumming have a working formula anywhere in the sheet. Which you do according to your question.
Assuming your Sheet doesn't have a code like Application.Calculation = xlCalculationManual , to say your Sheet is in automatic calculation mode it will show you the running results.
You use key press or enter events in the Form to update the Sheet column CC
Your approach with buttons and message box seems fine. Why don't you give it a try and let us know with any issues you face.
Some hints:
UserForm1.Show vbModeless property
Allow worksheet access while user form is open
Editing spreadsheet while user form is open
How to show messagebox from cell changed event while user form is open?