I have created a simple MDI application with the MFC class wizard. At the moment I have only one view and one document. The view has CListView as a base class. I have disabled the new file option on startup by using cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; The user can either call a add menu option that displays a dialog box with which they can add data to the database, or they can pick a view menu option which will allow them to view all the data added on that particular day. My problem is calling the view from the mainframe menu option. I have read several articles but they all deal with adding documents and views and then swopping between them. I know I'm probably being very dense but have tried the whole of yesterday with no success.:-O . This is the code I'm using to initialize the List view in myView::OnInitialUpdate. DWORD dwExStyle; CRepPartDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); //CActionsApp *pApp = (CActionsApp*)AfxGetApp(); CListCtrl& m_List = GetListCtrl(); dwExStyle = m_List.GetExStyle(); dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES; m_List.SetExtendedStyle(dwExStyle); m_List.SetBkColor(RGB(255, 255, 255)); ASSERT(m_List.GetBkColor() == RGB(255, 255, 255)); m_List.InsertColumn(0,_T("Share"),LVCFMT_LEFT,160); m_List.InsertColumn(1,_T("Status"),LVCFMT_LEFT,90); m_List.InsertColumn(2,_T("Action Date"),LVCFMT_LEFT,90); m_List.InsertColumn(3,_T("Book Date"),LVCFMT_LEFT,90); m_List.InsertColumn(4,_T("Comment"),LVCFMT_LEFT,160); Someone has suggested calling OnFileNew() from my menu handler but no success. Please help! Any suggestions will be more than I have already! Grasp it but you cannot get it! It's name is memory..
Jasmyn
Posts
-
How do you call a default view in MDI application? -
Calling CListview in MDI applicationHad a cup of tea, am felling calmer so here are more details. The view that I'm trying to call is derived from CListview and is a report style List view showing database information in an Access like gridview. This is the code I'm using to initialise it DWORD dwExStyle; CRepPartDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); //CActionsApp *pApp = (CActionsApp*)AfxGetApp(); CListCtrl& m_List = GetListCtrl(); dwExStyle = m_List.GetExStyle(); dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES; m_List.SetExtendedStyle(dwExStyle); m_List.SetBkColor(RGB(255, 255, 255)); ASSERT(m_List.GetBkColor() == RGB(255, 255, 255)); m_List.InsertColumn(0,_T("Share"),LVCFMT_LEFT,160); m_List.InsertColumn(1,_T("Status"),LVCFMT_LEFT,90); m_List.InsertColumn(2,_T("Action Date"),LVCFMT_LEFT,90); m_List.InsertColumn(3,_T("Book Date"),LVCFMT_LEFT,90); m_List.InsertColumn(4,_T("Comment"),LVCFMT_LEFT,160); I have used it before in a SDI application that opened on this view with no problems whatsoever, which leads me to believe there must be a special way of calling the same view from a menu within a MDI application that I'm missing. This is the only code I have in the menu handler function at the moment CRepPartApp* pApp = (CRepPartApp*)AfxGetApp(); pApp->m_pDocManager->OnFileNew(); All the example's I can find deals with multiple document and views and switching between them. It is a new job and I'm feeling a bit incompetent:-O so any pointers would be much appreciated:) Grasp it but you cannot get it! It's name is memory..
-
Calling CListview in MDI applicationI have created an MDI application whose view is derived from CList. I only have one view and one document. I have used the cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; option to disable the default OnFileNew(). Now I have a application that opens with only a menu. How do I now call my List view(default view) from the mainframe menu? I have added a menu Item, attached a handler to it and tried calling OnFileNew from there. But no List view. Sob.:(( I have read a million msdn files, 2 chapters on MDI applications but still no flashes of intelligence. I'm trying to populate my ListView9defaultview) with items by directly accessing its list control through a call to GetListCtrl() in the OnInitialUpdate() function in my view class. If I take the code populating the control out from OnInitial update, I get a white empty file opening, if I leave it in I get a file with exactly the same grey background as my main window. Am I maybe missing the plot completely? I hope I'm making sense, my brain is so fried it took me 20 minutes to find my office key and leave the building. Please help!:eek: Grasp it but you cannot get it! It's name is memory..
-
A dreamOften when I have a nap in the late afternoon I am still awake enough to "think" thoughts, yet see the completely unrelated visual images(dream pictures) being produced by them. Seems to me there is some process/problem in your live that you feel unequipped to handle on your own without additional assistance. Also the person presenting you with the challenge seem to not only have all the necessary knowledge/tools whatever but is giving you unsufficient time to come up with the right solution. Meanwhile you are desparately looking for the secret knowledge inside yourself. As you wake up you realize you are just a paper notepad and will never understand the way women think:laugh: . To make things more interesting every person in a dream is suppose to represents ourselves:confused: Grasp it but you cannot get it! It's name is memory..
-
No more Visual Fox Pro!Paul Watson wrote: So do you two have "make up coding" when you get back together after a tiff? Never mind how good the making up is after the coding tiffs :-O To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!It does things for me that he claims Linux and Perl does for him so we are all happy together;) To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!Wherever it counts most;) To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!Nish [BusterBoy] wrote: Geez! You can do that eh? Depends how big you are :laugh: To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!****Christian Graus wrote: I thought the idea was to be able to beat *them* up ? We train with different levels so I often fight with people bigger and stronger than me who can't afford to be beaten up by a girl. It's good though cause it keeps me from getting to confident and picking fights in bars just for the fun of it. Men tend to be much stronger and it pays not to forget this. ****Christian Graus wrote: I do Tae Quon Do myself, but I still suck at it at this point... It just gets better! ****Christian Graus wrote: I've never heard it called that before.... It is a type of wrestling were you try pin someone on their back for 30 seconds. The trick is to try and stay on your stomach when someone pins you down, that way it is easier to get up and shake them of. Once you are on your back you are stuffed To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!Thank you, kind sir. But I trust the goodness of my fellow coders and I meant no harm To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!Why thank you. I was definitely a girl last time I checked:-O But I do Kung Fu so I get beaten up by guys a lot. X| But all the Chinese wrestling more than makes up for it:-D To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!****Christian Graus wrote: The way to respond to this is to calmly say 'you may feel you're resolving the issues, but I do not. If you're refusing to accept my resignation, feel free to keep putting money in my bank account after I stop coming in, which will be on this date...' Ha, Ha I wish I spoke to you first before resigning. I have a friend who worked for a telephone company, hated it so much he just got up and left on day four and they continued paying his salary into his acount for the next 5 months. Never even realized he was gone:laugh: To overcome everything is to reach an invisible height where users cease to exist
-
Heap, stack?HockeyDude wrote: stack is used for temporary static variables, heap is used to create dynamic variables. Thank you that clarifies everything! :rolleyes: To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!The way you refuse to let someone resign is you say: "Why ever could you wish to leave?" and to every answer you reply with what you consider to be sound reasoning and a definite "now that that is sorted give me the next problem" Very effective especially if you keep on repeating "No, definitely not" and talk over whoever is trying to argue a point. I tried to introduce the idea of COM but got it's been working fine for the last 20 years why change. THAT is when I decided to leave. As for Microsoft burying the body in the desert I think this guy waited till they were gone and reserrected it chanting "never change", and is now single handedly keeping it alive. He claims THEY will never allow Microsoft to get away with IT so Microsoft is toeing the line, the result being Visual FoxPro. I tried telling him that not one of the 7 bookshops I contacted even knew what FoxPro was never mind stocking the books, he replied that we live in a backward country and what else did I need to discuss with him. In his defense he is a nutter but he truly beliefs alll he says and his wife is a fab cook;P To overcome everything is to reach an invisible height where users cease to exist
-
Heap, stack?I know what a heap is, I know what a stack is but how do they relate to each other? I'm trying to reach a better understanding of memory management and not being able to put them in context is really throwing me.I know the question is a bit vague but so is my understanding at this point.:-O To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!Sorry, haven't used this one for a while. Fixed it. To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!After a few years getting it on starts getting on but a good piece of code can always handle additional fiddling To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!After a few years getting it on starts getting on but a good piece of code can always handle additional fiddling To overcome everything is to reach an invisible height
-
No more Visual Fox Pro!Not only do they exist, when I tried to resign my boss wouldn't let me. He told me that C++ was redundant, that Foxpro was the only way to go, that there were IMPORTANT people keeping a eye on Microsoft stopping them from ruining a good product or discontinuing it and that he could not possibly allow me to ruin my live and career by resigning! The only way I could finally resign was to send a formal letter of resignation by E-mail. To overcome everything is to reach an invisible height where users cease to exist
-
No more Visual Fox Pro!:laugh: You were all so right about it being a nightmare language. I'm back with C++ and it feels better than when I got back with my ex and we managed to sort out all. Found an interesting book by someone who wrote a C++ interpreter called Under C.(C++ by Example-Steve Donovan) Made me realize that there are better things to do in life than make lots of money and get on with everyone you work with. Love and dynamite comes in small packages