Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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.
@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,
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
@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:
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,
@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:
hi,
- I'm using Creo 7.0.2.0;
- jdk1.8.0_152 + eclipse Mars (4.5.1);
- jre1.8.0_152
regards
Hi,
in uploaded 2020-12-25.zip file you can find modified version of your project.
List of modified files:
I compiled project using kompilace.bat
How to run my package:
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.
@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.
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