|
For a state that is either 1 or 0
eg True or False wouldn't a check box be the best type of control to use.
And a combo dropdown box be best for the other fields ?
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I am sick of fighting with Martin, I think I will ignore his posts from here on in, and spend the time working on articles instead.
Christian Graus
|
|
|
|
|
I'm looking for sample code on implementing Listview printing using SDK style programming.
|
|
|
|
|
I tried:
CTrain1View * pView = (CTrain1View *)GetActiveView();
pView->m_listdisplay.ShowWindow(SW_SHOW);
in a mainframe handler, where m_listdisplay is a listcontrol in the view,. Compiles fine but crashes when run....memory could not be read.
CAn you please tell me what I'm doing wrong?
Thanks very much,
ns
|
|
|
|
|
In what function are u doing so? is the control already constructed, or is it destructed after ure doing this?!!?!
Check it out!
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
i think it's depends on proc your are calling "ShowWindow" from.
window must be created before to show it (:
----------------
muaaa ..
i have no time to do something good ):
|
|
|
|
|
Are you checking m_listdisplay.m_hWnd to ensure the control is a valid window?
|
|
|
|
|
I found that:
CTrain1View * pView = (CTrain1View *)GetActiveView();
if(pView == NULL) AfxMessageBox("trouble");
pView is NULL. I dont even reach the line where I'm trying to get at the control (which probably isnt created yet).
The trouble I had was that I can only modifymenu with the sample i have, if I call it from MAinFrame class menu handler. (My coding inexperience)
CString str;
CString str1 = "Display2";
CString str2 = " Save selection ???";
mmenu->GetMenuString(ID_DISPLAY2, str, MF_BYCOMMAND);
if (str == str1)
{
// m_listdisplay.ShowWindow(SW_SHOW);
mmenu->ModifyMenu(ID_DISPLAY2, MF_BYCOMMAND,ID_DISPLAY2, " Save selection ???");
pMain->DrawMenuBar();
}
if (str == str2)
{
mmenu->ModifyMenu(ID_DISPLAY2, MF_BYCOMMAND,ID_DISPLAY2, "Display2");
pMain->DrawMenuBar();
In response to the menu title changing, in the mainframe handler I'm trying to get the control to get visible in the view. The null pointer is telling me the view isnt active yet, which isnt true since I have seen the gui already (thats where I press the menu to switch titles). I am using another sample that someone gave me to create my view (I need to be switching between views so I use this since it doesnt destroy the hidden view):
BOOL CMainFrame::SwitchView(CMultiDocTemplate *pTemplate, CRuntimeClass *pViewClass)
{
CMDIChildWnd* pChild = (CMDIChildWnd*) MDIGetActive();
if ( pChild == NULL ) return FALSE;
CDocument* pDoc = pChild->GetActiveDocument();
if ( pDoc == NULL ) return FALSE;
CView* pView;
POSITION pos;
pos = pDoc->GetFirstViewPosition();
while( pos != NULL )
{
pView = pDoc->GetNextView( pos );
if( pView->IsKindOf( pViewClass ) )
{
pView->GetParentFrame()->ActivateFrame();
return TRUE;
}
}
pChild = (CMDIChildWnd*) pTemplate->CreateNewFrame(pDoc, NULL ); //error here ERROR: Dialog with IDD 0x0082 must have the child style.
if( pChild == NULL ) return FALSE;
pChild->MDIActivate();
pTemplate->InitialUpdateFrame( pChild, pDoc);
return TRUE;
}
ANy pointers would be greatly appreciated,
thanks,
ns
|
|
|
|
|
Two things I learned:
The view doesnt own a menu
2. The mainframe doent have a view, the childframe does.
|
|
|
|
|
Ok, this is a pretty small thing, but i'm sorta curious now... Is there an easy / standard way of retrieving a user's default Outlook signature? I'm asking because sending a message via MAPI does not attach a user's signature by default, and some people miss that.
Shog9
--
Maybe Java is kind of like God, it "works in mysterious ways". It seems like your apps are running slowly, because in the backgroud Java is solving world hunger, or finding the cure to cancer.
- Ryan Johnston, Don't die java!
|
|
|
|
|
I think Outlook is quite complex,
I have searched and can't find out where its stored
In OE I have done it via registry settings.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I am sick of fighting with Martin, I think I will ignore his posts from here on in, and spend the time working on articles instead.
Christian Graus
|
|
|
|
|
hai ...
a have some problems with memory
when creating Tabbed Dialogs ...
(when TCITEM.lParam = pointer to dialog ..)
every things i do correct, but after closing program
debugger sad:
Detected memory leaks!
Dumping objects ->
E:\home\projects\kTalk\MainDlg.cpp(343) : {105} client block at 0x00345438, subtype 0, 160 bytes long.
a CDialog object at $00345438, 160 bytes long
... and e.t.c ...
====================
ovverriding i also destroying them ...
CWnd *pWnd = (LPARAM)tci.lParam;
delete pWnd;
===============
maybe i should destroy them in other way ??
thanks
----------------
muaaa .. (:
|
|
|
|
|
I could be just guessing (as usual, but finding a bug is just a matter of a right guess anyway). I'm just gonna write some typical bugs (i've had these problems myself recently):
1. Before deleting a window (CWnd object) destroy a window with ->DestroyWindow() unless it isn't done earlier.
2. Before destroying a window make sure it doesn't own some objects like brushes, device contexts etc. - it could be it
3. before destroying any brush/context etc. make sure it's not selected by other objects - that's something I'm aware of very much
4. before creating any object destroy the previous one (example - I've been calling CBrush::CreateSolidBrush twice for the same CBrush object without calling CBrush::DeleteObject)
5. Maybe that tab control is the reason (it or it's elements are not deleted or destroyed - read carefully what they say about deleting it and it's structures)
Remember - be patient (yeah, right... )
Greetings to all assembler dudes and especially for C64 demoscene!
|
|
|
|
|
But i have done it !!! (:
there is my DEL proc :
int CMainDlg::DelTab(int Index)
{
TC_ITEM tci;
CChatDlg *pWnd;
int iCount = m_tabs.GetItemCount();
int iCurrent = m_tabs.GetCurSel();
m_tabs.GetItem(Index,&tci);
ASSERT(tci.lParam);
pWnd = (CChatDlg *)tci.lParam; //CChatDlg is CDialog
pWnd->DestroyWindow();
pWnd = NULL;
delete pWnd;
m_tabs.DeleteItem(Index);
};
Sometimes its works... but i can't found a bug .. (: there it is .. !?
----------------
muaaa .. (:
|
|
|
|
|
Mandalay wrote:
there is my DEL proc :
int CMainDlg::DelTab(int Index)
{
TC_ITEM tci;
CChatDlg *pWnd;
int iCount = m_tabs.GetItemCount();
int iCurrent = m_tabs.GetCurSel();
m_tabs.GetItem(Index,&tci);
ASSERT(tci.lParam);
pWnd = (CChatDlg *)tci.lParam;
pWnd->DestroyWindow();
pWnd = NULL;
delete pWnd;
m_tabs.DeleteItem(Index);
};
Sometimes its works... but i can't found a bug .. (: there it is .. !?
Why do you set the pointer to NULL before deletion? Perhaps I missed something in another reply to this message...
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
As I said: be patient - inspecting the code I've noticed You reversed the order of two code lines. The proper order is:
delete pWnd;
pWnd = NULL;
...no comment...
PS: Although delete doesn't set the pointer to NULL it is not necessarry to do that unless it's the only information about existance of an object.
Greetings to all assembler dudes and especially for C64 demoscene!
|
|
|
|
|
Deleting a NULL pointer will do nothing and the original memory never gets freed. Try:
delete pWnd;
pWnd = NULL;
Best regards,
Alexandru Savescu
|
|
|
|
|
I'm not sure whether this will work, but it's simple to try. Override PostNcDestroy for your tabbed dialogs and add delete this as the last line of the function.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
...but keep in mind that "delete this" can be dangerous
Just kiddin'. Although delete operator removes the object, the code always remain in the memory (one for all objects of course).
I've just never seen anybody using "delete this".
Greetings to all assembler dudes and especially for C64 demoscene!
|
|
|
|
|
I agree with you the procedure is a little weird, but this is the standard way to cleanup MFC modeless dialogs, for instance.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks.
hehe. it works, no errors, no leaks .. no warnings ...
but sometimes ... it works without "delete this".
i couldnt understand.
(:
----------------
muaaa .. (:
|
|
|
|
|
Greetings:
I have an application whose view class is derived from CHtmlView. All is good except I do NOT want the user to be able to right click and have access to the 'Back', 'Forward', etc. that is available from the menu.
I have tried adding a handler for ::OnRButtonUp(UINT nFlags, CPoint point), but this never gets called.
If I can just disable the right click menu, that would be fine. If I have to use a message override, I can just return nothing... I just need to trap the ON_WM_RBUTTONUP (or equivalent).
Thanks in advance for any help.
Alan Schneider
|
|
|
|
|
The proper way to do it is via the IDOCHOSTUIHANDLER flags.
The RButton messages will be interecpted long before your APP gets a chance
You could use PreTranslateMessage in desperation.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I am sick of fighting with Martin, I think I will ignore his posts from here on in, and spend the time working on articles instead.
Christian Graus
|
|
|
|
|
Thanks for the suggestion - It worked.
I went ahead and used the PreTranslateMessage method since I only care about one single event... the right button up.
BOOL CMyHtmlView::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message != WM_RBUTTONUP)
{
return CHtmlView::PreTranslateMessage(pMsg);
}
return TRUE;
}
Alan Schneider
|
|
|
|
|
In a mainframe event, the following
m_wndToolBar.GetToolBarCtrl().HideButton(ID_EDIT_COPY, TRUE);
does fine and hides the button. How do I hide a separator? I would have to specify its position as well, since I didnt see anything like ID_SEPARATOR1 etc...
THanks for your help,
ns
|
|
|
|
|
I have a horrible feeling you might be forced to remove and add all (except the offending separator) buttons again.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|