The field only permits the user to set data if the blinking cursor appears in text area prior to entering data.
I tried to activate JavaWindow, SetFocus on JavaEdit to get cursor blink. Didn't work. Here is the code I've tried:
JavaWindow("ABC").Activate
JavaWindow("ABC").JavaEdit("XYZ").SetFocus
JavaWindow("ABC").JavaEdit("XYZ").Set "Hello"
' UFT recorded script to get blink and enter data as follows. This doesn't work during execution.
JavaWindow("ABC").JavaEdit("XYZ").SetCaretPos 0,0
JavaWindow("ABC").JavaEdit("XYZ").Set "Hello"
What is the handle name to be used while calling createcaret, in case i need to create one before using SetCaretPos.
Will try sendkeys now. Any other ideas are to get focus on JavaEdit are welcome.
Related
I am working with adempiere, I would like to Hide/Show field of a window based on tick mark available in another window Client which is (AD_Clinet table). E.g. I created barcode field in Material Receipt window which i would like to show only when Client screen Scan Barcode On Material Receipt is tick marked. I am using Display logic of window Tab Field > Tab > Field ,following things are tried by me
AD_Client.Is_ScanBarcodeMaterialReceiot
Barcode_Field= #SELECT Is_ScanBarcodeMaterialReceiot FROM AD_Client WHERE AD_Client_ID=##AD_Client_ID##
#Barcode_Field=AD_Client.Is_ScanBarcodeMaterialReceiot#
I didn't got proper output for that.
Please provide suggessions to solve out this problem.
The display logic in ADempiere does not support sql statements. You can use the SQL in a virtual column and then reference that column in your display logic.
So add a Yes/No virtual column to the table with the sql value set to
SELECT AD_Client.Is_ScanBarcodeMaterialReceipt FROM AD_Client WHERE AD_Client_ID=##AD_Client_ID#
Call this column by the same name Is_ScanBarcodeMaterialReceipt. Add it to the window/tab but don't display it. The value should appear in the context when you open the window.
Then you can set your display logic on the bar code field to
#Is_ScanBarcodeMaterialReceipt#=Y
i was instructed to make a text editor using socket programming where there is one server and multiple clients.
when any client changes anything in their text editors the text changes should reflect on all the text editors of all clients.
to make this happen i used action listener to send each and every change to the server and then i used moveCaretposition to move the cursor to the end of the text (without it the cursor position resets to the position of the first character) . the problem i'm facing right now is that whenever the cursor goes back to the end of the text the text gets highlighted , and because the changes reflect on all clients including the client who's making the changes, this client basically can't write , because whenever he tries to type anything the text gets overwritten by the new characters he's typing , since the previous was selected
is there anyway to deselect this default selection every time the changes reflect? so that the clients can actually write in their text editors.
i tried grabfocus (), getfocus() ,moveCaretPosition using both getdocument and getText
but still there's something im missing
while(true) {
String NewDatainTextArea = ClientInput.readLine();
c1.ChangeText(NewDatainTextArea);//c1 is a text editor object
c1.t.moveCaretPosition(c1.t.getText().length());
c1.t.grabFocus();
}
is there anyway to deselect this default selection every time the changes reflect? so that the clients can actually write in their text editors.
I have a table of forms which accepts first name, last name etc. When I navigate through using the tab key and enter some text in first name, all of the text disappears and that row gets selected. I have tried almost all techniques.
Is there any way we can avoid that using coding?
If I use the mouse then it wont give that error.
Assuming an otherwise correct use of JTable, you may need to terminate the edit when focus is lost, as suggested here and here:
table.putClientProperty("terminateEditOnFocusLost", true);
I'm designing a program simulating a vending machine. You know how vending machines have that one large text box that displays whatever messages you need to know...that's what I want to do. So basically, if the user clicks a button and if the item is out of store, expired, they don't have enough credit, whatever, the message should be displayed in this box.
Then, after a second or 2, return to displaying how much money the user put into the machine. I also want to make the box so that, well theres a button next to the text box to click to insert money. When they click that, I want to make the text box editable, they then enter the amount of money they want to enter, then press insert again, and the money is inserted. The text box becomes uneditable again, and displays the credit they have in the machine.
Does anyone have any suggestions as to how to do this?
I also was wondering how I could implement the delay before getting rid of the message and returning to displaying the credit in the machine. Thank you.
As Andrew Thompson says, you would use a JTextField. Set the desired text using the setText() method and you could then use a sleep function (usleep() I think should work for your application) and then set the text again back to the Dollar value.
Edit: didn't see the last half. To enable and disable the textfield entirely, use setEnabled(true/false), to stop it from being editable, use setEditable(true/false)
Also, just thinking, you could get the current date in a timestamp format and then enter a loop where you continually get the timestamp and compare it to the first one. If the desired difference is reached then exit the loop and update the textfield. Have a look at the Java doc for Date ;)
My scenario:
Trying to automate Calculator using Sikuli(Java). I need to get the result (in text) every time an operation is completed.
Example: 1 * 2 = 2. Need to capture '2' from the resulting area/region.
Can some one please help me how can I do it?
The result may be dynamic, so It becomes important for me to read it in run time and then compare it with the input values.
Thank you,
Mike
If the resulting area is a text field you can click on it, copy the text to the clipboard and read it from Env.getClipboard():
click("text_field.png")
type("a", KEY_CTRL)
type("c", KEY_CTRL)
print Env.getClipboard().strip()
Another way is to find left and right borders of the result field, drag the mouse cursor from left border to the right, copy the text via ctrl+c and use Env.getClipboard() to get it.
Hope that helps.