cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Defaultvalue for UIReadStringMessage(true);

DieterKotsch
4-Participant

Defaultvalue for UIReadStringMessage(true);

How can i define a Default value for the UIReadStringMessage(true);

The command appears in my jlinkapp without a defaultvalue. On page 79 of the helpfile you can read the note.

A default value is displayed in the text box as Input.

When user presses the Enter key as input in the user interface, the default value is not passed to the

Creo Object TOOLKIT Java method; instead, the method returns a constant string use_default_string. When this string is returned, the application

must interpret that the user wants to use the default value.

3 REPLIES 3
sjuraj
13-Aquamarine
(To:DieterKotsch)

I do not know how to display default value at the input, but the string use_default_string is just flag for using default value you define in your code, so you can do:

String myDefaultValue = "my_parameter_name";

String result = session.UIReadStringMessage(true);


if(result.equals("use_default_string");

   result = myDefaultValue;


//rest of your code ...


If you need to inform user what is default string value you can display it in the message log using method UIDisplayMessage

Alternatively you can display default string using new process, which will create GUI and then dissapear, like the Android is displaying short messages e.g. when you set alarm.

DieterKotsch
4-Participant
(To:sjuraj)

HI

Thanks a lot.

But I'm looking for the to display a default value at the input or to define a Combobox at the input in Jlink.

sjuraj
13-Aquamarine
(To:DieterKotsch)

Hi, if you want combobox you can easely create jDialog and fill it with combobox or listview. You can also fill jDialog with JFXPanel, which enable you to use JavaFX components into swing component. With JavaFX you can create really nice and modern looking GUI. I suppose you can create such thing as combobox in j-link. To create GUI is issue of java object toolkit.

Top Tags