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

ProToolkit: Add a menu pushbutton

Highlighted
Regular Member

ProToolkit: Add a menu pushbutton

Hello,

I wanted to add a menu button for my Toolkit App. Therefore I used the source code of the installation test as a reference. Everything worked well, and I could run my little test program via the pushbutton, but I have problems changing the name of the pushbutton.

Parts of my source code (Layout changed a little somehow…):

static wchar_t  MSGFIL[] = {'u','s','e','r','.','t','x','t','\0'};

	//Test Access for MenuButton
	static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode)
	{
    return (ACCESS_AVAILABLE);
	}
int user_initialize(int argc, char *argv[], char *version, char *build) //argc: number of arguments; *argv[]: arguments passed by Creo Parametric		
{
	//Add button to menu bar
	ProError status;
	uiCmdCmdId	cmd_id;
    ProMessageDisplay( MSGFIL, "USER %0s", "" );
    status = ProCmdActionAdd("-TestApp",
	(uiCmdCmdActFn)selectSurface,
	uiProe2ndImmediate, TestAccessDefault,
	PRO_B_TRUE, PRO_B_TRUE, &cmd_id);

    status = ProMenubarmenuPushbuttonAdd("File", "-TestApp", "-Install Test Label", "Install Test Help",
	"File.psh_rename", PRO_B_TRUE, cmd_id, MSGFIL);
	return (0);
}

The problem is, if I change "-Install Test Label" and "Install Test Help" in ProMenubarmenuPushbuttonAdd, the button isn´t being displayed anymore.

Does anyone know how I can change the name of a Pushbutton? I didn´t find the ProMenubarmenuPushbuttonAdd method in the documentation.

Furthermore, how is the MSGFILE connected to all this? This file is the one that should be in the text_dir in my protk.dat file, right?

 

Thanks in advance

2 REPLIES 2
Highlighted

Re: ProToolkit: Add a menu pushbutton

Can't you do that by creating a resource file (.res) and adding the menupane defined in there to the menu bar?
The resource file can be created by using a regular text editor.
Several examples can be found in the Toolkit examples and there is a good description of it in the file "tkuse.pdf".

Highlighted

Re: ProToolkit: Add a menu pushbutton

The text for menu label ("-Install Test Label") in your example and one line help ("Install Test Help") is defined in MSGFILE. If you want to replace those strings you need to add the new label and help line blocks to MSGFILE.

 

Regarding the MSGFILE you are correct, the file location is given by the text_dir line in your protk.dat file and the file name itself is defined in the following line:

static wchar_t  MSGFIL[] = {'u','s','e','r','.','t','x','t','\0'};

 

In the user guide, under the "User Interface: Messages" chapter (Chapter 14), look for "Text Message File Format and Restrictions" section. This is where the location and the format of the message file is explained in detail.

 

 

Announcements