Home > Archive > Tcl > May 2004 > Setting application title in OSX/Aqua
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Setting application title in OSX/Aqua
|
|
| Peter Linich 2004-05-14, 10:32 pm |
| Hi,
Is there a way to set the application title in the menubar in the Tcl/Tk
Aqua port for Mac OSX?
Whenever I run any wish scripts the application name (next to the apple
symbol) is always "Wish", and I'd like to change it to the name of my
script.
Thanks,
Peter
| |
| Robert 2004-05-14, 10:32 pm |
| "Peter Linich" <plinich@cse.unsw.edu.au> wrote in message
news:plinich-16817F.11053015052004@tomahawk.comms.unsw.edu.au...
> Hi,
>
> Is there a way to set the application title in the menubar in the Tcl/Tk
> Aqua port for Mac OSX?
>
> Whenever I run any wish scripts the application name (next to the apple
> symbol) is always "Wish", and I'd like to change it to the name of my
> script.
>
> Thanks,
>
> Peter
Does this help?
wm title . "Application Title"
I am not sure about OSX but on Windows I usually do this as well:
raise .
Which usually raises my Tk app to the top position.
HTH (I am learning as well)
Robert
| |
| Peter Linich 2004-05-14, 10:32 pm |
| Hi,
Using:
wm title . "Application Title"
Changes the title of my main window (ie. the text in the title bar of the
window itself), but doesn't change the "Wish" in the menu bar at the top
of the screen.
I had already tried that, but thanks for the suggestion, though.
Peter
In article <sdSdnfEM-pkl8jjdRVn-hQ@adelphia.com>,
"Robert" <catcher@linuxmail.org> wrote:
> "Peter Linich" <plinich@cse.unsw.edu.au> wrote in message
> news:plinich-16817F.11053015052004@tomahawk.comms.unsw.edu.au...
> Does this help?
>
> wm title . "Application Title"
>
> I am not sure about OSX but on Windows I usually do this as well:
>
> raise .
>
> Which usually raises my Tk app to the top position.
>
> HTH (I am learning as well)
>
> Robert
>
>
| |
| SM Ryan 2004-05-15, 9:31 am |
| Peter Linich <plinich@cse.unsw.edu.au> wrote:
# Hi,
#
# Is there a way to set the application title in the menubar in the Tcl/Tk
# Aqua port for Mac OSX?
#
# Whenever I run any wish scripts the application name (next to the apple
# symbol) is always "Wish", and I'd like to change it to the name of my
# script.
In tkMacOSXMenus.c,
void
TkMacOSXInitMenus(
Tcl_Interp *interp)
{
static char *aboutTitle = 0;
if (!aboutTitle) {
Tcl_DString appname;
CFBundleRef bundleRef = CFBundleGetMainBundle();
CFDictionaryRef bundleInfoDict =
bundleRef
? CFBundleGetInfoDictionary(bundleRef)
: 0;
CFStringRef bundlenameCF =
bundleInfoDict
? CFDictionaryGetValue(bundleInfoDict, CFSTR("CFBundleName"))
: 0;
char *bundlename =
bundlenameCF
? CFStringGetCStringPtr(bundlenameCF, CFStringGetSystemEncoding())
: 0;
Tcl_DStringInit(&appname);
Tcl_DStringAppend(&appname, "#About ", -1);
if (bundlename) {
Tcl_DStringAppend(&appname, bundlename, -1);
}else {
TkpGetAppName(interp, &appname);
}
//if (bundlenameCF) CFRelease(bundlenameCF);
Tcl_DStringAppend(&appname, "É", -1);
aboutTitle = malloc(Tcl_DStringLength(&appname)+1);
strcpy(aboutTitle, Tcl_DStringValue(&appname));
*aboutTitle = strlen(aboutTitle+1);
Tcl_DStringFree(&appname);
}
gInterp = interp;
/*
* At this point, InitMenus() should have already been called.
*/
if (TkMacOSXUseMenuID(256) != TCL_OK) {
panic("Menu ID 256 is already in use!");
}
tkAppleMenu = NewMenu(256, "\p\024");
if (tkAppleMenu == NULL) {
panic("memory - menus");
}
InsertMenu(tkAppleMenu, 0);
AppendMenu(tkAppleMenu, (unsigned char*)aboutTitle);
AppendMenu(tkAppleMenu, "\p(-");
/* Not necessary in Carbon:
AppendResMenu(tkAppleMenu, 'DRVR');
*/
if (TkMacOSXUseMenuID(kFileMenu) != TCL_OK) {
panic("Menu ID %d is already in use!", kFileMenu);
}
tkFileMenu = NewMenu(kFileMenu, "\pFile");
if (tkFileMenu == NULL) {
panic("memory - menus");
}
InsertMenu(tkFileMenu, 0);
AppendMenu(tkFileMenu, "\pSourceÉ");
AppendMenu(tkFileMenu, "\pClose/W");
AppendMenu(tkFileMenu, "\p(-");
AppendMenu(tkFileMenu, "\pQuit/Q");
if (TkMacOSXUseMenuID(kEditMenu) != TCL_OK) {
panic("Menu ID %d is already in use!", kEditMenu);
}
tkEditMenu = NewMenu(kEditMenu, "\pEdit");
if (tkEditMenu == NULL) {
panic("memory - menus");
}
InsertMenu(tkEditMenu, 0);
AppendMenu(tkEditMenu, "\pCut/X");
AppendMenu(tkEditMenu, "\pCopy/C");
AppendMenu(tkEditMenu, "\pPaste/V");
AppendMenu(tkEditMenu, "\pClear");
if (TkMacOSXUseMenuID(kHMHelpMenuID) != TCL_OK) {
panic("Help menu ID %s is already in use!", kHMHelpMenuID);
}
DrawMenuBar();
EnableMenuCommand(NULL, kHICommandPreferences);
return;
}
--
SM Ryan http://www.rawbw.com/~wyrmwif/
The little stoner's got a point.
| |
| Will Duquette 2004-05-17, 2:34 pm |
| Peter Linich <plinich@cse.unsw.edu.au> writes:
> Hi,
>
> Is there a way to set the application title in the menubar in the Tcl/Tk
> Aqua port for Mac OSX?
>
> Whenever I run any wish scripts the application name (next to the apple
> symbol) is always "Wish", and I'd like to change it to the name of my
> script.
>
> Thanks,
>
> Peter
There is, but it's tricky. You have to package your script as a
".app", which is non-trivial. You should read the README file for
TclTkAqua, which has a little to say about it; you should also join
the Tcl-Mac mailing list. You can find the answers you need in the
mailing list archives.
Will
| |
| Peter Linich 2004-05-17, 8:31 pm |
| Hi,
Thanks for this. I've joined the mailing-list and rummaged through the
archives. I've found what I need. Thanks for the lead.
Peter
In article <6tvfivnfph.fsf@dhcp-78-62-241.jpl.nasa.gov>,
Will Duquette <will@dhcp-78-62-241.jpl.nasa.gov> wrote:
> Peter Linich <plinich@cse.unsw.edu.au> writes:
>
>
> There is, but it's tricky. You have to package your script as a
> ".app", which is non-trivial. You should read the README file for
> TclTkAqua, which has a little to say about it; you should also join
> the Tcl-Mac mailing list. You can find the answers you need in the
> mailing list archives.
>
> Will
| |
| Uwe Koloska 2004-05-18, 5:31 am |
| SM Ryan wrote:
> Peter Linich <plinich@cse.unsw.edu.au> wrote:
> # Hi,
> #
> # Is there a way to set the application title in the menubar in the Tcl/Tk
> # Aqua port for Mac OSX?
>
> In tkMacOSXMenus.c,
This brings me to an interesting question:
Is someone working on a package that deals with this specialities of
Aqua? Just like the apple java-extension that makes it easy to make
a java application looking like a native cocoa app.
Uwe Koloska
--
voiceINTERconnect www.voiceinterconnect.de
.... smart speech applications from germany
| |
| SM Ryan 2004-05-18, 2:33 pm |
| Uwe Koloska <koloska@voiceinterconnect.de> wrote:
# SM Ryan wrote:
# > Peter Linich <plinich@cse.unsw.edu.au> wrote:
# > # Hi,
# > #
# > # Is there a way to set the application title in the menubar in the Tcl/Tk
# > # Aqua port for Mac OSX?
# >
# > In tkMacOSXMenus.c,
#
# This brings me to an interesting question:
# Is someone working on a package that deals with this specialities of
Off and on.
Porting Tk to Cocoa looks like that by itself would provide a wealth of
new features.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
A bunch of savages in this town.
|
|
|
|
|