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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Renaming note windows

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
oO_no1_Oo Posted - 09/24/2004 : 09:42:33 AM
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
5   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 09/27/2004 : 12:22:24 PM
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.
oO_no1_Oo Posted - 09/27/2004 : 03:50:50 AM
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
rlewis Posted - 09/24/2004 : 1:43:46 PM
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 ...
cpyang Posted - 09/24/2004 : 12:04:28 PM
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
rlewis Posted - 09/24/2004 : 12:01:35 PM
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);
}

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000