|
Ok,
the design that the data is common to many classes and
still only resides in the dialog class ...???
Well I think that u can see whats' wrong here ..??
The design is wrong, IF you want the data to be accessible to all
classes you should put the data as a seperate entity and then
you should use that to instantiate the data(or simply a pointer to the
data in the dialog will be enough)
Although there may(will) be technical work arounds to this prob,
I think that a change in design will eliminate any other problems
you might encounter in future.
|
|
|
|
|
I suppose one way is to make the input variables static (and public) members of your dialog class. This will allow you to access them from other places using the CMyDialog::m_myStaticMember notation. However, I recommend you spend some time to think about where these variables really belong and how they will be accessed.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Hi, my name is Rui, i'm using VC++ 6.0 with WXP!
I ahve a form with lots of objects, and i need to acess each object0s member variable in a dinamic way. In VB it was quite easy to create an array in order to control a number of objects, but in VC++, i don't know how to do that!
Can you help me?
Thank you for your time!
|
|
|
|
|
You'll have to do it manually. Class Wizard won't help you there
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
You cannot do this using the class wizard.
But what you can do is something like this.
Assume that you have 10 edit boxes and you would like to
access them thru a string, then
declare in the header like this
CStringArray m_strEdit[10] ;
Now in the Dialog's DoDataExchange, you could write code like this,
DDX_Text(pDX, IDC_EDIT1, m_strEdit[0]);
DDX_Text(pDX, IDC_EDIT2, m_strEdit[1]);
DDX_Text(pDX, IDC_EDIT3, m_strEdit[2]);
..
..
Just a bit copy & paste and your r ready, by the way there
are many things in VC++ that u cannot do in VB(comparitively more more..)
|
|
|
|
|
Thank you, Prem, for your quick and easy-to-understand answer.
Even so, i get an error by using a CStringArray as the 3º parameter of the DDX_TEXT, the complete error sentence is :
- none of the 12 overloads can convert parameter 3 from type 'class CStringArray' -
What do you think i am possibily doing wrong?
|
|
|
|
|
I found the problem..
Thank you once more...
|
|
|
|
|
Hi, I can't seem to find help on the above in MSDN. I have added two radio buttons to my dialog. I have inserted them into a Group box.
Firstly, I'm not sure how to make another group of radio buttons that work separately from the first. In other words the two groups must not be mutually exclusive. Only the buttons in that group.
Secondly, I tried to use the class wizard to create member variables for the radio buttons. The class wizard does not give that option. It only allows me to handle events for each radio button. How do I make a radio button enabled or disabled. How do I check what radio option has been selected.
Thanks.
Rui
|
|
|
|
|
Groups of radio buttons are not defined by enclosing them in group boxes. Instead, check for the tab order of the radios. The n-th group consists of the n-th radio having the "tab stop" property, up to the (n+1)-th. I hope I made myself clear enough, my English is a bit sluggish today.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm not sure I understand having the tab stop property. Do you mean it must be set.
So if I add two radio buttons and make their order 1 and 2. Do I set radio 2's tab stop property.
Then if I add radio button 3 and 4. And make their tab order 3 and 4. Do I again set 4's tab stop property.
Does this make the 2 pairs of radios work independently, i.e. if I click 2 it deselects 1. But if I click 3 it will not deselect 2.
Thanks
Rui
|
|
|
|
|
It is sort of like you say, but the "tab stop" property marks the beginning of the group (if my memory serves me well.) Just try it out and get the hang of it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
As for the second question, the following determines whether a given radio (or check) button with identifier ID_WHATEVER is checked:
bool checked=(static_cast<CButton*>(GetDlgItem(ID_WHATEVER))->GetState()&0x003)==BST_CHECKED;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Do you mean to say that there is no easier way than this. Is there no way to assign a variable to the actual control, like all the other controls.
I need to manipulate other properties of this control?
Ruca
|
|
|
|
|
Well, when I've had the need to do this, I've just used the code provided before. This does not mean there can't be a simpler way. I haven't tested this, but you might want to try it out: insert some dummy regular button and associate it a CButton member variable. Then change manually in your .cpp the references to the ID of this button to the ID of your radio, delete the dummy button and see if things work. [and please tell us back ]
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I did the following:
I added the radio buttons.
Then I manually (not using the wizard) declared variables of type CButton ( for the control) and CString (for the value), as well as inserting the necessary lines of code in the data exchange.
This works and allows one to have all the usual interaction with CButton controls. The only disadavantage of this is that one then needs to add the necessary code to check and uncheck the radio buttons when one is selected.
Rui
|
|
|
|
|
On the first radio button of the second group properties, check the "group" checkbox on the first tab. this will mark it as the first button of the second group.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Thanks Michel,
that does the trick.
Rui
|
|
|
|
|
Well, this is not actually a C++ problem. It's rather a problem with the VS.net IDE and a macro I wrote (but the macro runs on top of a C++ project ).
The macro worked very well all the time, but today it started to give me this error:
"QI for IEnumVARIANT failed on the unmanaged server."
QI means QueryInterface, that's clear, but the whole thing doesn't make much sense since the macro worked very well all the time.
So does anybody know what the problem might be (and how to solve it)? Or is this just one of the annoying bugs in VS.net?
Hope someone can help me
|
|
|
|
|
According to the docs, when CFileDialog adds the default extension to a name entered by the user without it, only the first three characters are appended. So, if the default extension is .mydoc , it returns whatever.myd . I've checked this to be true for Win95, while in 98 the whole extension is added.
Is there any standard workaround for this proved to work in all OSs (9x, NT, etc.)? Of course, I want the whole extension to be added.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaq
MSDN says "This string can be any length, but only the first three characters are appended"
But you say that this is true only in Win95. It 98 and upper OSs, there is a bug [actually a very useful feature] where the full extension is added. Hmmm.
Curious. And I am sorry I don;t have a solution
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
That's weird behavior.
I don't have a proven workaround, but here's what I'd do:
1. Set the lpstrDefExt member to NULL.
2. After DoModal, check the file name for a period. If it doesn't have one, append your default extension (.mydoc) to it.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Does anyone know how to display the copy progress dialog box? Chris Maunder and Michael Dunn's dialog wrapper both look very good:
http://www.codeproject.com/miscctrl/#Progress Controls
But I do not know how to implement it with progress... I am using CFileFind and CFileFind::FindNextFile( ) to find the source files. I use ::CopyFile( ) to copy files, which can only copies 1 file at a time. Thus I have no way of finding out total # of files or total copying size.
Help!??
Thanks.
|
|
|
|
|
You can use SHFileOperation. It'll not only show the copy-progress bar, but is also recycle-bin-aware
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
You can also use CopyFileEx which accepts a callback function as an argument.
|
|
|
|
|
How can I use a dialog box that browse FOLDER in my program?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|