Accessing a document from classes that are included in a dialog

Hi,

I have a dialog that includes a class "ListBoxPair" which includes 
"ListBox". In this class, I would like to access the doc to update variables

What is the best way to do it?

Many thanks
0
liat_oren (16)
6/1/2005 10:50:03 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
399 Views

Similar Articles

[PageSpeed] 0

Thank you very much.

I am sorry for the stupid question, I am just new in it:
Should I write a constructor that gets this argument? How should it look like?

An additional question, when it works, how do I go up to get this doc (from 
the class I mentioned before)?

Thank you very much for your help

"Scott McPhillips [MVP]" wrote:

> Liat wrote:
> > Hi,
> > 
> > I have a dialog that includes a class "ListBoxPair" which includes 
> > "ListBox". In this class, I would like to access the doc to update variables
> > 
> > What is the best way to do it?
> > 
> > Many thanks
> 
> Pass the document pointer to the dialog constructor.
> 
> -- 
> Scott McPhillips [VC++ MVP]
> 
> 
0
liat_oren (16)
6/1/2005 12:21:05 PM
Liat wrote:
> Hi,
> 
> I have a dialog that includes a class "ListBoxPair" which includes 
> "ListBox". In this class, I would like to access the doc to update variables
> 
> What is the best way to do it?
> 
> Many thanks

Pass the document pointer to the dialog constructor.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
6/1/2005 12:42:05 PM
Liat wrote:
> Thank you very much.
> 
> I am sorry for the stupid question, I am just new in it:
> Should I write a constructor that gets this argument? How should it look like?
> 
> An additional question, when it works, how do I go up to get this doc (from 
> the class I mentioned before)?
> 
> Thank you very much for your help

You can change the dialog constructor to accept any parameters you want.

// The standard c'tor
CProgDlg::CProgDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CProgDlg::IDD, pParent)
{

// You could change it to this:
CProgDlg::CProgDlg(CMyDocument* pDoc, CWnd* pParent /*=NULL*/)
	: CDialog(CProgDlg::IDD, pParent)
{
    m_pDoc = pDoc;

Now other places in the dialog class can use m_pDoc to access the 
document.  If the dialog creates other objects that also need access to 
the dialog use the same technique.  Add a document pointer to the c'tor 
parameters and pass m_pDoc for that parameter.

p = new ListBoxPair(m_pDoc);
-- or --
ListBoxPair pair(m_pDoc);

.... and the ListBoxPair c'tor can save the pointer.

This is what C++ constructors are for.  When you create an object you 
must pass it any external data or reference it needs.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
6/1/2005 11:18:27 PM
Reply:

Similar Artilces:

Outlook Web Access AutoSignature
I would like to know if it's possible to have autosignature in Outlook Web Access, and if so how to implement it. If anyone can help, it would be greatly apreciated. Thank You. It depends on the version of Exchange - Outlook Web Access is a function of Exchange, not Outlook. Exchange 2003 does this natively, previous versions may have a third party add-in that will allow users to do this. For better information, post in an exchange group such as microsoft.public.exchange.admin. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due t...

Restricting access to note attachments
Hi all, is there a way to restrict access to attachments on notes to specified users. I know we can, using the Security Roles, define who can and can't read/ write the notes fields but we would like our users to be able to view the note, but not open the attachment(s) unless they are the owner of that note (or at least in the business unit, etc.). I know this could be done for Word/ Excel files in Office (Password protection) but are looking for something more encompassing for all attachments inside CRM. Thanks, -- Matt Pring On Oct 21, 3:54=A0pm, Matt Pring <MattPr...@discus...

creat id badges including an image
Can anyone tell me how to create id badges using data and an image please? I can use access, excel, word or publisher. Thank you. In Publisher, simply use a badge template (label), insert your picture. If you are merging data it is a straightforward operation. What version Office? Mail, e-mail, and catalog merge http://office.microsoft.com/en-us/publisher/CH100502901033.aspx With Word, look at this article http://www.gmayor.com/graphics_on_labels.htm -- Mary Sauer http://msauer.mvps.org/ "Angel_1" <Angel1@discussions.microsoft.com> wrote in message news...

Access 2003 and Access 2007 Synchronization
I'm setting up a new business relationship with a company in Portugal. They use Access 2003. I have just bought MS Office Professional 2007 (with Access 2007). Our plan is that they will send, once a month or so, their Access db then we will update and add to that db and then return it after another month or so. There probably won't be a lot of updates on our end so the monthly cycle should work. After they synchronize, they will send a new version of the db and we will start over. My goal is to keep everything as simple as possible partially because I don't know how skillf...

Open file dialog on Vista
I am adapting my apps for Vista. The apps need to run on all Win32/Win64 platforms, and are still in VC6, with the February 2003 PSDK. By writing my own version of CFileDialog (based on Paul DiLascia's code) I was able to obtain the file dialog with the places bar on W2K/XP, while showing the old file dialog on other platforms. But what do I need to do to get the new Vista open file dialog on Vista? As it is I am getting the XP one. David Wilkinson Hi David, I don't know a lot about that level of Vista yet (just used it as a user, haven't really ported to it yet), but...

Including Ship To Address 'User Defined' fields on SOP Invoice.
How do I include the Ship To 'User defined 1 and 2 fields' on an Invoice? The ship to is defined on the customer maintenance card and differs from the Select Address Code for the customer ('PRIMARY' vs. 'SHPTO'). I can retrieve the Ship To Address line 1 thru 3 using the RW_AddressLine1 .... RW_AddressLine3 functions. However I can not determine how to retrieve other data maintained under this Address ID from the Customer Address Table. How do I achieve this? That's because the User Defined fields you are looking for are in the Customer Master Address tab...

Excel Row to Access Columns
Hi, I have a single row in Excel with a lot of data, what I need to do is move that to a column in Access. I need some way to automate that. I know the easiest way to do that would to just transpose it in excel and then import in access.But I cant do that as I just get that excel file with one row and I need some way to automate the process in Access. thanks m -- mk389 ------------------------------------------------------------------------ mk389's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15272 View this thread: http://www.excelforum.com/showthread.php?...

Help displaying a random record in a form--Access newbie
Hello, I am new to Access, so if anyone can help me, please assume I know absolutely nothing! I currently have a table with two columns, ID and CHORE. In each row, the ID number corresponds to a chore that I have entered. I would like to create a form with a button and a text field such that when I press the button, a random chore is displayed in the text field (supposed to make chores more "fun" for my son). There is no need to remove this record from future clicks (the same record can come up over and over without any problem for me) Can anyone explain to me (in pai...

Access
Hi My form takes a few moments to load up as it is fairly substantial SQL statement is there a way to get something to display a graphic or 'loading...' message to appear why it calculate the contents? Steve ...

Erro while importing SOP documents using Integration Manager
I've been using Integration Manager to import sales transactions into GP. The procedures and integration has been the same for several years now. Just this morning I started getting the following error message for some of the documents: DOC 2 WARNING: 'Override Shortage' option was selected for quantity shortage on Line 1 for item 666999258259 The integration completes however the system will not allow me to post the batch. I checked a few items associated with the error and there is no quantities on hand however that has not caused a problem in the past. Thanks for you...

access mail on WEB
Is there a way i can check emails from exchanger server 5.5 from an internet browser. I have Exchange 5.5 in win NT 4.0. Thanks! Yes - install OWA (Outlook Web Access) and open up the needed ports in your firewall (80 for http; better to use SSL and port 443 instead). disk0nek wrote: > Is there a way i can check emails from exchanger server > 5.5 from an internet browser. > > I have Exchange 5.5 in win NT 4.0. > > Thanks! ...

X-Axis @ 0 wont work (PIC INCLUDED)
I have a dual y-axis graph... one series has negative values and causes the x-axis to move... ive tried using the "x-axis @ 0" but it doesnt work office XP PIC: http://www.ironchefbadass.com/www/chart.jpg the only way i can get it to sort of look right is if i play with the minimum value for the left hand y-axis.. there has to be a real way todo it right... thanx guys -- scrupul0us ------------------------------------------------------------------------ scrupul0us's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=14184 View this thread: http://w...

word 2007 document prints every other line of text.
word 2007 document started printing every other line of type as of yesterday. Document shows okay in print preview, but prints incorrectly. If Print Preview appears OK and you are using an Inkjet printer, I would suspect that you have a problem with the ink nozzles in the printer. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "bh" <bh@discussions.microsoft.com> wrote in message news:C2A0B201-CA31-4482-B538-B...

access or mount mirrored hard disks
Hi, is it possible to access a mirrored harddrive? or mount the mirrored volume by using api or mfc commands? Thank you in advance Wimpi ...

Access Database In Great Plains
I was wondering if anyone knew how to have the databases that are stored in access transfered over to great plains. I'm current running version 8.0 any help would be greatful. thanks Search Customer Source for integration Manager. MS Access databases can be used as a data source. Vincev "jake" wrote: > I was wondering if anyone knew how to have the databases that are > stored in access transfered over to great plains. I'm current running > version 8.0 any help would be greatful. thanks > > Hi Jake, Is this something you need to do regularly or is it ...

CRM v4 Accessibility Improvements
Hi all: Does anyone know if any improvements have been med to CRM v4 in the area of accessibility for handicapped users? One of my customers has a user who is blind and they need to make the software accessible to him. Thanks in advance for any and all help. John. Hi John, We have added following Accessibility features in CRM 4.0 : 1) High Contrast Mode (Tools --> Options --> General Tab --> Enable high contrast settings) 2) All the Form input elements have <LABEL FOR> to aid in screen readers. 3) All the Images have a ALT tag (for non text elements) etc. Thanks! Ma...

Upsizing Access to SQL Server 2000
Hello, I am new to SQL Server. I am trying to use the Database upsizing wizard to upsize a Access 2000 database into SQL Server 2000. They are both on the same machine (running Win 03 Server). I cannot connect to the SQL Server. Error as below: Connection failed: SQLState: '01000' SQL Server Error: 14 [Microsoft][ODBC SQL Server Driver][Shared Memory] ConnectionOpen(Invalid Instance()). SQLState: '08001' SQL Server Error: 14 [Microsoft][ODBC SQL Server Driver][Shared Memory]Invalid connection. ...

Outlook Web Access #19
We have have OWA at my work and I would like to configure Outlook 2003 to synchronize with my desktop at work, is this possible Thanks B ...

Can't get document to print preview or print in color
I'm using Publisher 2007 to create a monthly newsletter. The document is in color while I'm working on it but when I print preview it shows black/white. I've tried to toggle using the color/grayscale button but it just stays black/white. It also won't print in color. However, when I email it to others, they can view and print it in color. I've tried using my original program disk to "fix" Publisher and I've also uninstalled and reinstalled the program. I'm having a blonde moment and think there must be an easy fix for this but I'm at a loss...

Have a user account accessible to multiple users
I have an issue where there is a user account that has multiple alias emails.(reservations@domain.com, info@domain.com, CustomerService@domain.com) I have an exchange 2003 server. My issue is that i need to have muliple users access these emails so they are never missed. What is the best way to accomplish this? I was thinking a public folder. But i want to know the best way to do this? On Sat, 12 Jun 2010 21:37:04 -0500, "Dan V" <dvalenti54athotmail.com> wrote: >I have an issue where there is a user account that has multiple alias >emails.(reservati...

Going offline without write access to registry
I suggest that POS doesn't go offline if it can't write into registry, displaying a message box instead telling that it couldn't access the registry. What happens if the POS machine goes offline without having access to edit the registry? This typically happen when the user is a normal user (not a power user) 1. The POS application will try to connect to the server main database within the pre-configured ‘Connect Timeout’ in the RMS Administrator (Typically 15 seconds) 2. The application will then try to connect to the pre-defined offline database (which is usually stored loc...

View settings for open/save dialogs ?
Helo, Running windows 7 pro 64bit. I want to select certain icon view setting for open/save dialogs for all files/dirs. For now I was able to set custom view for certain file/dir - but all others are forced details view. I want to set them all at once and permanently. How do I do that ? Main explorer window customizes ok. thanks Vilius ...

Access 2000 problem if opened with Access 2007
Dear all, I'm running Access 2000 MDE in Access 2007. I find several header-details form (such as invoice transaction), the details form is displayed as white box without any record displayed. Is there any solution for this matter ? Thanks. Chlaris. you need to move to Access Data Projects if you want a reliable, predictable environment "Chlaris" <chlarrissa_nospam@yahoo.com> wrote in message news:ON0rS1NsHHA.3884@TK2MSFTNGP04.phx.gbl... > Dear all, > > I'm running Access 2000 MDE in Access 2007. I find several header-details > form (such as inv...

Accounting with Ms Access
Hello all I have been working on a database for are small retail Tile company (we do everything by pen and paper now). I have been able to setup a working Orders/Invoice table and forms, CreditMemo table and forms, and PurchaseOrder table and forms all based on the Northwind Sample Database. "Thanks to all the help here". I have been searching for a sample database with accounting. With A/R, A/P, Billing Statements and so on. I am not a programmer or accountant so the chance of me doing something wrong is pretty good. I am hoping that someone has a add-in MsAccess database for ...

BP3 Site Settings access
I've installed BP3 on web server as domain admin, with sep. SQL 2005 server for SPS and GP databases. On SQL2005 have given BusinessPortalUser full db rights. Site admin is sts_user, with domain admin rights in AD. When login to BP3 Home Page from domain admin, most features work 100%. However on Site Settings I get "the server (server) at Digest requires a username and password". Cannot login as domain admin, continually asks for username / pwd. When login as sts_user, Site Settings Center displays, with Registered Users section shows as below. Also cannot go to Users / Site...