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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Adding Menu Buttons in J-Link

uavron
1-Newbie

Adding Menu Buttons in J-Link

Hi,



It might sound a silly problem, but for some unknown reasons I can add buttons to existing menus only as the first button. If I add a button and define the neighbour of the requested button, I do not get anything.


Anybody has a snippet of J-Link code that includes adding a button into a certain position in an existing menu, so that I can find what I am doing wrong?


Thank you in advance

5 REPLIES 5
bfrandsen
6-Contributor
(To:uavron)

Here is how I add a menu with submenues.
session = pfcGlobal.GetProESession();
session.UIAddMenu("jlink", "Utilities", "beo_jlink.txt", null);
session.UIAddMenu("pcb", "pe", "beo_jlink.txt", "jlink");
session.UIAddMenu("nc", "pcb", "beo_jlink.txt", "jlink");
session.UIAddMenu("op", "nc", "beo_jlink.txt", "jlink");

And here is adding buttons to the submenus:

UICommand m03HRNamingcommand = null;
UICommand m03DXFExportcommand = null;
try
{
m03HRNamingcommand = session.UICreateCommand("M03HRNaming", new
M03HRNamingListener());
session.UIAddButton(m03HRNamingcommand, "pcb", null, "M03HRNaming menu",
"M03HRNaming help", "beo_M03HRNaming.txt");
m03DXFExportcommand = session.UICreateCommand("M03DXFExport", new
M03DXFExportListener());
session.UIAddButton(m03DXFExportcommand, "pcb", null, "M03DXFEXport
menu", "M03DXFExport help", "beo_M03DXFExport.txt");
}
catch (Throwable x){}

Regards,
Bjarne



Uriel Avron <->
31-08-2011 06:48
Please respond to
Uriel Avron <->


To
<->
cc

Subject
[proecus] - Adding Menu Buttons in J-Link






Hi,

It might sound a silly problem, but for some unknown reasons I can add
buttons to existing menus only as the first button. If I add a button and
define the neighbour of the requested button, I do not get anything.
Anybody has a snippet of J-Link code that includes adding a button into a
certain position in an existing menu, so that I can find what I am doing
wrong?
Thank you in advance

Site Links: View post online View mailing list online Send new post
via email Unsubscribe from this mailing list Manage your subscription
Use of this email content is governed by the terms of service at:

To get the correct name of the neighbor button, set the config.pro option 'cmdmgr_trail_output' to 'no'. This allows button names to be captured in the trail file.


This exampleadds a "Print PDF" buttonabove the "Drawing Options" button in the "File" menu:


curSession.UIAddButton (cmd, "File", "DetailFile.psh_draw_options", "Print PDF",
"Print the current drawing in PDF", "msg_createpdf.txt");

uavron
1-Newbie
(To:uavron)

Thank you Mary and Bjarnee for your prompt reply.
Unfortunately, your advices didn't work, perhaps because I haven't made
myself clear enough in the initial question.
This is the situation:
I have a simple application written in J-Link and the menu is placed under
the Edit main menu. Here is the code:
....
try{
Session curSession = pfcGlobal.GetProESession( );

UICommand cmd = curSession.UICreateCommand ("ShadeFiles", new
MenuButtonListener());

curSession.UIAddButton (cmd, "Edit", null, "Shadow_Files",
"Create Shadow Files for NPI", "GetRevision.txt");
}
...
Very simple and it works
Now I want to add a new button under this application, but from a DIFFERENT
application:
....
try{
Session curSession = pfcGlobal.GetProESession( );

UICommand cmd = curSession.UICreateCommand ("CreateParams", new
MenuButtonListener());

curSession.UIAddButton (cmd, "Edit","ShadeFiles", "CreateParams",
"Create Standard Parameters for the Model",
"CreateParams.txt");
}
.....
Now, the second application doesn't add anything, in spite of the fact that
the command button name "Shadefiles" is correct.
Even if I use any of the existing other buttons of the existing menu, I get
nothing. If I put "null" instead of "ShadeFiles", I do get a new button on
the menu, but if I click on it, I get the the application ShadeFiles run
instead of Createparams.... It is very frustrating because I am sure that I
am doing something trivially stupid...
Could you please open my eyes?

Thank you

Uriel

On Wed, Aug 31, 2011 at 9:02 AM, Bjarne Frandsen <->wrote:

>
> Here is how I add a menu with submenues.
> session = pfcGlobal.GetProESession();
> session.UIAddMenu("jlink", "Utilities", "beo_jlink.txt", null);
> session.UIAddMenu("pcb", "pe", "beo_jlink.txt", "jlink");
> session.UIAddMenu("nc", "pcb", "beo_jlink.txt", "jlink");
> session.UIAddMenu("op", "nc", "beo_jlink.txt", "jlink");
>
> And here is adding buttons to the submenus:
>
> UICommand m03HRNamingcommand = null;
> UICommand m03DXFExportcommand = null;
> try
> {
> m03HRNamingcommand = session.UICreateCommand("M03HRNaming", new
> M03HRNamingListener());
> session.UIAddButton(m03HRNamingcommand, "pcb", null, "M03HRNaming menu",
> "M03HRNaming help", "beo_M03HRNaming.txt");
> m03DXFExportcommand = session.UICreateCommand("M03DXFExport", new
> M03DXFExportListener());
> session.UIAddButton(m03DXFExportcommand, "pcb", null, "M03DXFEXport
> menu", "M03DXFExport help", "beo_M03DXFExport.txt");
> }
> catch (Throwable x){}
>
> Regards,
> Bjarne
>
>
> *Uriel Avron <->*
>
> 31-08-2011 06:48
> Please respond to
> Uriel Avron <->
>
> To
> <->
> cc
> Subject
> [proecus] - Adding Menu Buttons in J-Link
>
>
>
>
> Hi,
>
>
>
> It might sound a silly problem, but for some unknown reasons I can add
> buttons to existing menus only as the first button. If I add a button and
> define the neighbour of the requested button, I do not get anything.
>
> Anybody has a snippet of J-Link code that includes adding a button into a
> certain position in an existing menu, so that I can find what I am doing
> wrong?
>
> Thank you in advance
>

Try:
curSession.UIAddButton (cmd, "Edit","JL.ShadeFiles", "CreateParams",
"Create Standard Parameters for the Model",
"CreateParams.txt");

When I select the "createpdf" button I showed in my example, I see the
following in the trail file:
!Application (createpdf): CmdMgr action_func '' called for cmd
'JL.createpdf'

So, if I want to add a button above this one, I would need to specify
"JL.createpdf" in UIAddButton.

Hope that helps.





uavron
1-Newbie
(To:uavron)

Thank you Mary, I'll try that, though in my Trail File the "JL." addition
didn't show

All the best

Uriel

Top Tags