Click to See Complete Forum and Search --> : Global variables with dialogs


LouLou
October 28th, 1999, 07:01 AM
I am working on an email package and would like to click a button in the addressbook dialog box and have the email address appear in the TO: edit box of the Sendscreen. One way is to declare a global variable to hold the address and transfer it that way, but I am not sure in which dialog the global variable would be decarled and how to transfer the address over. I hope this makes sense.

Thanks

Louise

Kelly
October 29th, 1999, 06:45 PM
Hi Louise,
One way to do this might be as follows:

The addressbook dialog class has a public member called "CString field_to". When you click on the Address Book button (which I assume to be in the same dialog for the new message), the addressbook dialog opens and the user makes a selection (or cancels) and on closing, the adresssbook dialog code sets the value for "field_to" appropriately. (note that additional fields could be configured/set in the same way using additional containment variables). When the addressbook.DoModal() returns, the new_message code immediately checks the value for addressbook.field_to and, if valid, either sets the TO field to the addressbook.field_to value, or appends the addressbook.field_to value to the end of a list. This, I think, would only work if the send_message window owns the addressbook dialog.

I hope this helps,

--Kelly

LouLou
November 1st, 1999, 01:06 PM
I have tired to declare a variable of the Sendscreen and try to bring the address from the addressbook into the sendscreen but it is not working. I either get the error that the variable for the sendscreen is an undeclared identifier or if the make it a sendscreen variable it will not but the addresss in the sendscreen. What I need to do is declare it as a dummy global variable, but I am not sure how to do this.

Louise