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

problem with jlink OnCommand method.

Gucio
Amethyst

problem with jlink OnCommand method.

Hi folks,

 

I'm new to j-link. Could somebody explain what is wrong in my code?? why OnCommand method doesn't show message window??

thx in advance for all help.

Krzysztof
Tags (2)
10 REPLIES 10

Re: problem with jlink OnCommand method.


@Gucio wrote:

Hi folks,

 

I'm new to j-link. Could somebody explain what is wrong in my code?? why OnCommand method doesn't show message window??

thx in advance for all help.


Hi,

my suggestion ... ask PTC Support.


Martin Hanák

Re: problem with jlink OnCommand method.

Martin,

It's good that you are in good mood.
PTC support is not to give an answer for "how to do it" -it is the last mail that I've received 😞

 

Regards

Krzysztof

Re: problem with jlink OnCommand method.


@Gucio wrote:

Martin,

It's good that you are in good mood.
PTC support is not to give an answer for "how to do it" -it is the last mail that I've received 😞

 

Regards


Hi,

I am sorry I do not understand the meaning of your reply.

Note:

If you need to get some help, you have to provide:

  • complete copy of your project (source code file, pictures, additional files, protk.dat)
  • information about Creo version you use
  • information about JDK version you use + method how you compile your application
  • information about JRE version you use in combination with Creo

 


Martin Hanák

Re: problem with jlink OnCommand method.

hi,

 

Let me explain in more details.

There is a sample code on https://github.com/forkedbranch/jlink-first.

This code uses MenuButtonListener class that extends DefaultUICommandActionListener.

But referring to otk_javaug.pdf (<load_point>\Common Files\otk_java_doc) - starting from page 102, OnCommand method is taken from UICommandActionListener interface and has to be overridden. And it is my problem because when I click on a button no action is performed.

 

hope - now is clear what is my issue.

 

regards,

 

 

Krzysztof

Re: problem with jlink OnCommand method.


@Gucio wrote:

hi,

 

Let me explain in more details.

There is a sample code on https://github.com/forkedbranch/jlink-first.

This code uses MenuButtonListener class that extends DefaultUICommandActionListener.

But referring to otk_javaug.pdf (<load_point>\Common Files\otk_java_doc) - starting from page 102, OnCommand method is taken from UICommandActionListener interface and has to be overridden. And it is my problem because when I click on a button no action is performed.

 

hope - now is clear what is my issue.

 

regards,

 

 


Hi,

please add following information:

  • Creo version you use
  • JDK version you use + method how do you compile your application
  • JRE version you use in combination with Creo

 


Martin Hanák

Re: problem with jlink OnCommand method.

hi,

- I'm using Creo 7.0.2.0;

- jdk1.8.0_152 + eclipse Mars (4.5.1);
- jre1.8.0_152

 

regards

Krzysztof

Re: problem with jlink OnCommand method.

Hi,

in uploaded 2020-12-25.zip file you can find modified version of your project.

List of modified files:

  • Launcher.java
  • protk.dat
  • messages.txt

I compiled project using kompilace.bat

 

How to run my package:

  • unzip file
  • set jlink_java_command in config.pro file
  • set java_app_classpath and text_dir in protkdat.dat file
  • set Target and Start in in _cr7020_Jlink shortcut properties
  • launch Creo using _cr7020_Jlink shortcut

screenshot.png

 


Martin Hanák

Re: problem with jlink OnCommand method.

Hi Martin,

 

in the beginning - all the best in 2021.


Your code works ok, but it's not what I'm looking for.

In both sample codes "MenuButtonListener" class extends "DefaultUICommandActionListener". But I'm new to j-link, and I'm trying to read API for Creo 7 - and there is no info about DefaultUICommandActionListener.

As I wrote earlier - on page 102 of Creo Object TOOLKIT Java User’s Guide, there is chapter "Menus Buttons and Menus". It is written that user should override "pfcCommand.UICommandActionListener.OnCommand" method.

So in your sample code I've try to change
DefaultUICommandActionListener {....}
into 
class MenuButtonListener implements UICommandActionListener{...}

But when I add missing methods and compile the code (no errors) - the program does not react when I click on the button.

I really appreciate that you've shared code, but as I mentioned earlier, I'm at the beginning, and I would like to know how it works, and when should I look for help/info about such kind of topics. 

Maybe you're right, that I should ask PTC about it - but I thought that I'm doing something wrong, and this is the reason why my app does not work.

 

Regards.

Krzysztof
Tags (1)

Re: problem with jlink OnCommand method.


@Gucio wrote:

Hi Martin,

 

in the beginning - all the best in 2021.


Your code works ok, but it's not what I'm looking for.

In both sample codes "MenuButtonListener" class extends "DefaultUICommandActionListener". But I'm new to j-link, and I'm trying to read API for Creo 7 - and there is no info about DefaultUICommandActionListener.

As I wrote earlier - on page 102 of Creo Object TOOLKIT Java User’s Guide, there is chapter "Menus Buttons and Menus". It is written that user should override "pfcCommand.UICommandActionListener.OnCommand" method.

So in your sample code I've try to change
DefaultUICommandActionListener {....}
into 
class MenuButtonListener implements UICommandActionListener{...}

But when I add missing methods and compile the code (no errors) - the program does not react when I click on the button.

I really appreciate that you've shared code, but as I mentioned earlier, I'm at the beginning, and I would like to know how it works, and when should I look for help/info about such kind of topics. 

Maybe you're right, that I should ask PTC about it - but I thought that I'm doing something wrong, and this is the reason why my app does not work.

 

Regards.


Hi,

if I were you I would study the J-link examples and use their code to create my application. I wouldn't try to try everything Java has to offer.

 


Martin Hanák

Re: problem with jlink OnCommand method.

Method SetIcon() accepts only image file name. Actual image file must be located in the text directory under resource directory. See documentation: 

 

IconFileName—Specify the name of the icon file, including the extension. A valid format for the icon file is the PTC-proprietary format used by Creo .BIF, .GIF, .JPG, or .PNG. The new pane is displayed with the icon image. If you specify the value as NULL, the default Creo icon is used. The default search paths for finding the icons are: ○ \\Common Files\text\ resource ○ \resource ○ \\resource The location of the application text directory is specified in the registry file

Announcements