|
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
|
|
|
|
|
Take a look at the SHBrowseForFolder function of the shell API.
|
|
|
|
|
Thank you Tak.
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
|
|
|
|
|
hi friend ,
char szFolderPath[MAX_PATH];
LPBROWSEINFO pBrowseInfo;
pBrowseInfo=new BROWSEINFO ;
pBrowseInfo->hwndOwner=m_hWnd;
pBrowseInfo->pidlRoot=NULL;
pBrowseInfo->pszDisplayName=szFolderPath;
pBrowseInfo->lpszTitle="the text u enter here is appeared in the top of the dialog ";
pBrowseInfo->ulFlags=BIF_RETURNONLYFSDIRS;
pBrowseInfo->lpfn =NULL;
pBrowseInfo->lParam=0;
pBrowseInfo->iImage =0;
LPITEMIDLIST pIdList;
pIdList=SHBrowseForFolder(pBrowseInfo);
SHGetPathFromIDList(pIdList,szFolderPath);
//Now u get the foder path in szFolderPath...
delete pBrowseInfo;
OK???
-Renjith
Trace The Bugs...
|
|
|
|
|
Thank you.
|
|
|
|
|
I'm getting an "Unhandled exeption" when running this function. I get it when it comes to the pBrowse->Next line. I have already tested if pBrowse is null and it isn't, neihter is pIdl. Here's the code
void OnOpenFolder()
{
BROWSEINFO bi = {0};
IShellFolder *pSf;
LPMALLOC pMalloc;
DWORD pActual = 0;
bi.hwndOwner = ghWnd;
bi.pidlRoot = NULL;
bi.lpszTitle = "Locate MP3 Folder";
bi.ulFlags = BIF_DONTGOBELOWDOMAIN;
bi.lpfn = NULL;
SHGetDesktopFolder (&pSf);
if (pSf)
{
LPITEMIDLIST pIdl;
pIdl = SHBrowseForFolder(&bi);
if (pIdl)
{
IEnumIDList *pBrowse;
SHGetMalloc(&pMalloc);
pSf->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
pBrowse->AddRef();
if (pBrowse)
{
while (pBrowse->Next(1, &pIdl, &pActual) == S_OK)
{
LVITEM Lvi = {0};
char szPath[MAX_PATH+1];
SHGetPathFromIDList(pIdl, szPath);
Lvi.mask = LVIF_TEXT;
Lvi.pszText = szPath;
Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
ListView_InsertItem(DlgItems[7], &Lvi);
}
}
pBrowse->Release();
}
pMalloc->Free(pIdl);
pMalloc->Release();
}
pSf->Release();
}
ghWnd is the hanlde to my window (yes, it's valid)
DlgItems[7] is the handle to a listview control, also valid.
Here's the exact error: "Unhandled exeption in app.exe (SHELL32.DLL): 0xC0000005: Access Violation."
Any help greatly appreciated
Thanks.
|
|
|
|
|
Just a clue:
There are some mistakes in your code. For example you have:
if(pBrowe)
{
...
...
}
pBrowse->Release();
Where as it should be:
if(pBrowse)
{
...
pBrowse->Release();
}
|
|
|
|
|
pSf->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse); Shouldn't you be asking for a IID_IEnumIDList ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm not quite sure, but here's my code now, with the IID_IShellFolder parameter in BindToObjet it works, but with the IID_IEnumIDList i get that unhandled exception.
void OnOpenFolder()
{
BROWSEINFO bi = {0};
IShellFolder *pSf;
LPMALLOC pMalloc;
LPENUMIDLIST pFolder = NULL;
DWORD pActual = 0;
LVITEM Lvi = {0};
char szFolderPath[MAX_PATH+1];
bi.hwndOwner = ghWnd;
bi.pidlRoot = NULL;
bi.lpszTitle = "Locate MP3 Folder";
bi.ulFlags = BIF_DONTGOBELOWDOMAIN;
bi.lpfn = NULL;
SHGetDesktopFolder (&pSf);
if (pSf)
{
LPITEMIDLIST pIdl;
pIdl = SHBrowseForFolder(&bi);
SHGetPathFromIDList(pIdl, szFolderPath);
Lvi.mask = LVIF_TEXT;
Lvi.pszText = szFolderPath;
Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
ListView_InsertItem(DlgItems[7], &Lvi);
if (pIdl)
{
IShellFolder *pBrowse = NULL;
SHGetMalloc(&pMalloc);
pSf->BindToObject(pIdl, NULL, IID_IEnumIDList, (LPVOID*)&pBrowse);
pSf->Release();
pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (pBrowse)
{
while (pFolder->Next(1, &pIdl, &pActual) == S_OK)
{
SHGetPathFromIDList(pIdl, szFolderPath);
Lvi.pszText = szFolderPath;
Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
ListView_InsertItem(DlgItems[7], &Lvi);
}
}
pBrowse->Release();
}
pMalloc->Free(pIdl);
pMalloc->Release();
}
pSf->Release();
}
Although there still is a problem. The SHGetPathFromIDList(pIdl, szFolderPath); sets the szFolderPath to <desktop folder="">\<one of="" the="" subfolders="" in="" folder="" i="" chose="" via="" shbrowseforfolder="">
Thanks
|
|
|
|