The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Renaming note windows
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

oO_no1_Oo

Albania
Posts

Posted - 09/24/2004 :  09:42:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.0 SR4
Operating System: Win2k

Hi everybody,

does anyone know how to rename and label a note window? The following code obviously works only for windows derived from the Page class.

void SetWindowTitel(string aWindowName, string aName,string aLabel)
{
Project myProject;
Page myPage;
PageBase myPageBase;

myPageBase=myProject.Pages(aWindowName);
myPageBase.Rename(aName);

myPage=(Page) myPageBase;
myPage.Label=aLabel;
myPage.LT_execute("page.title=3;");
}

Any help is much appreciated.

Ciao,

Martin

rlewis

Canada
253 Posts

Posted - 09/24/2004 :  12:01:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There are a few quirks with Note Windows when it comes to adressing the active notewindow.
The following works with 7.5-SR4.
I've not tested them with 7.0, but I think they should also work ...


#define WM_MDIGETACTIVE 0x0229
bool rename_relabel_active_note_window(string strNewNoteWinName)
{
Note nwin(strNewNoteWinName);
if(!nwin.IsValid())
{
HWND hWndMDI = GetWindow(OGW_MDICLIENT);
Window winMID(hWndMDI);
DWORD dw = winMID.SendMessage(WM_MDIGETACTIVE);
HWND hWndChild = (HWND) dw;
if(hWndChild)
{
foreach (Note nWin in Project.Notes)
{
if(nWin.GetWindow().GetSafeHwnd() == hWndChild)
{
nWin.Rename(strNewNoteWinName);
nWin.Label="NewLabel";
return (true);
}
}
}
}
return (false);
}

bool rename_relabel_note_window(string strNoteWinName, string strNewNoteWinName)
{
Note nWin(strNewNoteWinName);
if(!nWin.IsValid())
{
Note nwin(strNoteWinName);
if(nwin.IsValid())
{
nwin.Rename(strNewNoteWinName);
nwin.Label="NewLabel";
return (true);
}
}
return (false);
}
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/24/2004 :  12:04:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is a bug (#6966) with updating the notes window title so even after you change it, it will not show up until you hide and show it again, so use the following code



void note_rename(string strNote, string strName)
{
Note myNote(strNote);
if(!myNote)
return; // not found

myNote.Rename(strName);
myNote.Label = "Change to new name = " + strName;
myNote.TitleShow = WIN_TITLE_SHOW_BOTH;

// force it to update
myNote.SetShow(PAGE_HIDDEN);
myNote.SetShow();

}








CP


Edited by - cpyang on 09/24/2004 12:14:51 PM
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 09/24/2004 :  1:43:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It seems that Note.Rename("NewName") does not check to determine whether "NewName" name conflicts with the name of a pre-existing note window. It is thus possible to have two or more note windows with the same name. This is guaranteed to cause problems ...
Go to Top of Page

oO_no1_Oo

Albania
Posts

Posted - 09/27/2004 :  03:50:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
When I compile the first function a type mismatch error occurs in the following line:

Window winMID(hWndMDI);

However, the code of the second function works greate. I added the lines

nwin.SetShow(PAGE_HIDDEN);
nwin.SetShow();

to enforce a refresh to really show the changes.



Thanks for you prompt reply.

CU,

Martin
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 09/27/2004 :  12:22:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I just tried compiling that function in 7.0-SR4 and got the same error. I guess that particular function call is not supported in in pre 7.5 OriginC.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000