|
Hi All,
I'm using a CListCtrl in a dialog, and I've noticed that when it has the focus, the tab key will not cause it to change the focus to the next control in the tab order. Does anyone know what's up w/ this?
Note that OnGetDlgCode() is returning DLGC_WANTALLKEYS because I want to capture the Enter key. When I remove DLGC_WANTALLKEYS, the tab key changes the focus like I'm expecting, but it's a problem because I need to capture the Enter key.
How can I have my cake, and eat it too?
Thanks!!!
|
|
|
|
|
Try to narrow the problem down a bit. Does it happen with all projects or just this one? If the latter, does it happen with all list controls or just one in particular?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks for the reply! It was happening in every instance where my List Control was using my CListCtrl derived class that returned DLGC_WANTALLKEYS from OnGetDlgCode().
I came up a fix for it tho, which was to manually set the focus to the next window in the z-order (z-order == tab order).
Here's what my fix looked like:
BOOL CListCtrlEx::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB )
{
CWnd * pNext = GetWindow(GW_HWNDNEXT);
CWnd * pFirst = pNext ? NULL : ( pNext = GetWindow(GW_HWNDFIRST) );
while(pNext)
{
DWORD dwStyle = pNext->GetStyle();
if( dwStyle & WS_TABSTOP
&& pNext->IsWindowVisible()
&& pNext->IsWindowEnabled()
&& pNext->GetSafeHwnd() != m_hWnd )
{
pNext->SetFocus();
return FALSE;
}
pNext = pNext->GetWindow(GW_HWNDNEXT);
if( pNext == NULL && pFirst == NULL )
{
pNext = pFirst = GetWindow(GW_HWNDFIRST);
}
}
}
return CListCtrl::PreTranslateMessage(pMsg);
}
|
|
|
|
|
i want to dynamically create a tabctrl and add tabs dynamically to it. Also teh controls rendered on each tab will be dynamically created. Any suggestion of how it can be achieved.
|
|
|
|
|
i am successfully able to create the tabcontrol using the cdialog extended class as tabs. what is the difference in "can do and cannot do" if a property sheet is used instead? Which of the two is better to use and why?
|
|
|
|
|
Hi all,
I have a uchar array containing values of either 0 or 255 (ie monochrome) and am trying to BitBlt it into a window using the memory DC buffering to avoid flicker (ie creating a compatible memory DC, selecting a bitmap then BitBlting it to the window DC). The window is of the same size/slightly smaller.
1) I first attempted to use CreateCompatibleBitmap route (which I thought would be simplest?), using SetBitmapBits etc. The result was that the image was displayed twice in the top 2 quarters of the window, with nothing in the bottom half.
2) I also went down the CreateBitmapIndirect route using a BITMAP structure I managed to display only the first part of the array, which stretched to fill the bitmap. It looks like each 8 bit pixel value is being used to fill 8 pixels in the display, but I can't find how to set it to use 8 bits per pixel, without having to create a DIB type structure? (Setting the 255 values to 1 results in the same effect, but where there were 8 white pixels there are now 1 white and 7 black)
I really could do with using the Bit Blt function to run the process as fast as possible - can anyone suggest a solution?
Any help greatly appreciated - thanks!
|
|
|
|
|
what's wrong with just using a monochrome DIB?
set up the BITMAPINFOHEADER and palette, put your pixels into the rows, top-down, with padding on the ends of the rows to ensure that they're a multiple of four bytes wide.
-c
Software | Cleek
|
|
|
|
|
I have a control that subclasses CButton and I need it to be _exactly_ 256x256 pixels...
How can I set the exact Size of a control? I've tried editing the .rc, but the measures are given in DLUs...
Thank you people!!
|
|
|
|
|
MoveWindow???
How do I print my voice mail?
|
|
|
|
|
Thanks for your reply!
I was meaning at design time, not at runtime... I've fixed it temporarily with on-the-fly resizing during initialization... But I'd like to know if there is a standard method...
|
|
|
|
|
we/you can't really make a button have fixed PIXEL size in the resource editor, the units are DLUs, Dialog Logic Units, and are proportional to some windows dohickey ( big font, small font, ... ).
the only way to do it, is to use MoveWindow in the the dialog initialization, but watch out for big font vs. small font settings.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Don't waste your time. Thinking about pixels at design time is a sure recipe for failure. The whole reason, and beauty, for having DLUs is so that pixels do not matter. Otherwise, the controls will work on one machine and one machine only...yours. On any other machine, the results will be less than desireable. Things like resolution, font size, display driver, etc. will wreak havoc on your application.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I need to read a file from the server, then I will use the CInternetFile class for this (is anyone better ??).
Is need the configure anything in the server (or course, user and password) like samba ??
Thanks,
[]'s Cris
|
|
|
|
|
Cris wrote:
I need to read a file from the server, then I will use the CInternetFile class for this (is anyone better ??).
Are you asking how to read a file from the server, or use the CInternetFile class?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi
I am developing an ActiveX control in which i have placed a dialog box and and on that dialog box there are some controls like button control,edit control etc (its working fine). But when i add registered controls like flex grid control (from project>Add to project...>components and controls ...) on the dialog, the dialog box's m_hWnd member becomes NULL.
Does any one know how to solve this problem.its urgent please.
regards
Azam
|
|
|
|
|
Call AfxEnableControlContainer in InitInstance
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
thanks sir
Your reply has give my thought a new direction thank you very much;
could you plz send me a sample program that will help me a lot.
regards
Azam
|
|
|
|
|
A class that forma part of a larger software component implements the bubble sort and sequential search on ana array of type double.The client wishes to replace the bubble sort by the Quicksort and the sequential search by the binary search.Both the quicksort and binary search are to be implemented recursively.Use inheritance to implement the two classes and demonstrate the use of polymorphism
|
|
|
|
|
Can we first have the name of your instructor to see if it is permissible for others to do your homework? I'm sure asking for help on specific aspects of the problem is ok (only after you've tried and failed, though), but to just outright ask others to do your homework is an absolute no-no. Good luck!
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I need your help!!!!
I need to do a Dinamic menu during execution. The question is that I have a Menu, in this menu is a Submenu. OK, I need insert option in this Submenu and when click in one option execute a diferent functions.
How can I do it?
|
|
|
|
|
Hi,
How can I change the icon that is displayed in the menu bar when a document is maximized in an MDI application while it has no doc/view suport.
Best regards.
Thanks.
There is no spoon.
|
|
|
|
|
To change the icon get a pointer to the maximized frame window. You can then call SetIcon() on this. You will also have to call DrawMenuBar() on the main frame to get the change to be updated on the screen as it will not be redrawn until you do.
If you vote me down, my score will only get lower
|
|
|
|
|
the following is part of code from Nero SDK (NeroCmd), which recursively generate a ISO tree for buring, the main concept is finding all subfolder & folders of passed in directory "psFilename", this code works fine under console mode, but when I tried to put it to my MFC project my program always auto close due to it, but sometimes my code could get through without any modification, anybody knows what is going on here? is that because there's a memory limitation for MFC dialog application, due to the recursion here.
CExitCode CBurnContext::CreateIsoTree (const PARAMETERS & params, LPCSTR psFilename, NERO_ISO_ITEM ** ppItem, int iLevel)
{
// CFindFiles is a helper class for file and subdirectory handling
CFindFiles ff (psFilename);
*ppItem = NULL;
if (!ff.IsValidEntry())
{
if (0 == iLevel)
{
// If we haven't found any entries and we are on the
// first level of recursion then this should be
// reported as an error.
m_ErrorLog.printf ("File specification '%s' resulted in no matches!\n", psFilename);
return EXITCODE_FILE_NOT_FOUND;
}
else
{
// If we are on a level other than first, it is ok
// not to find any entries. This simply means we
// stumbled upon an empty directory somewhere in a tree.
return EXITCODE_OK;
}
}
char sPath[MAX_PATH];
// Make sure that we have no relative path names, but only absolute paths
if (NULL == _fullpath (sPath, psFilename, sizeof (sPath)))
{
// Our path buffer is too small. Bail out!
return EXITCODE_INTERNAL_ERROR;
}
// Find the last blackslash and remove it if found.
// This will leave us with a root directory.
LPSTR psBackslash = strrchr (sPath, '\\');
if (NULL != psBackslash)
{
*psBackslash = '\0';
}
do
{
std::string sNewPath;
sNewPath = sPath;
sNewPath += "\\";
sNewPath += ff.GetName ();
if (ff.IsSubDir())
{
// Here we handle subdirectories
// strcmp returns 0 on equal strings.
// Proceed if name contains none of "." or ".."
if ((0 != strcmp (ff.GetName (), ".")) && (0 != strcmp (ff.GetName (), "..")))
{
// Append a wildcard to the path and do a recursive search.
sNewPath += "\\";
sNewPath += ff.GetWildcard ();
NERO_ISO_ITEM * pNewItem = NeroCreateIsoItem ();
if (NULL == pNewItem)
{
DeleteIsoItemTree (*ppItem);
return EXITCODE_OUT_OF_MEMORY;
}
// Attach this item to the beginning of the list.
if (*ppItem != NULL)
{
pNewItem->nextItem = *ppItem;
}
*ppItem = pNewItem;
pNewItem->isDirectory = TRUE;
time_t t = ff.GetCreateTime ();
pNewItem->entryTime = *localtime (&t);
StoreFileName (pNewItem->fileName, pNewItem->longFileName, ff.GetName ());
// If we the user wants recursive search, only then do we
// actually recurse at deeper levels otherwise ignore directories
// alltogether.
//
if (params.GetRecursive ())
{
// Create an ISO item tree at a deeper level
EXITCODE code = CreateIsoTree (params, sNewPath.c_str (), &pNewItem->subDirFirstItem, iLevel + 1);
if (EXITCODE_OK != code)
{
DeleteIsoItemTree (*ppItem);
return code;
}
// We don't allow empty directories. This should probably
// be regulated by a command line switch.
//
if (pNewItem->subDirFirstItem == NULL)
{
// If the newly added directory is empty, remove it!
// We first detach it from the list and then
// deallocate it.
//
*ppItem = pNewItem->nextItem;
pNewItem->nextItem = NULL;
DeleteIsoItemTree (pNewItem);
}
}
}
}
else
{
// Here we handle regular files
NERO_ISO_ITEM * pNewItem = NeroCreateIsoItem ();
if (NULL == pNewItem)
{
DeleteIsoItemTree (*ppItem);
return EXITCODE_OUT_OF_MEMORY;
}
StoreFileName (pNewItem->sourceFilePath, (char *) pNewItem->longSourceFilePath, sNewPath.c_str ());
pNewItem->isDirectory = FALSE;
time_t t = ff.GetCreateTime ();
pNewItem->entryTime = *localtime (&t);
StoreFileName (pNewItem->fileName, pNewItem->longFileName, ff.GetName ());
// Attach this item to the beginning of the list.
if (*ppItem != NULL)
{
pNewItem->nextItem = *ppItem;
}
*ppItem = pNewItem;
}
ff.FindNext ();
}
while (ff.IsValidEntry ());
return EXITCODE_OK;
}
|
|
|
|
|
Default stack size is the same for MFC apps vs console apps (1MB if I remember correctly). However with an MFC app, you'll find much more of your stack being used by MFC itself. The console app doesn't have this overhead which is why it was running OK. Also, if you're running a debug build, a lot of the stack is being used by all the debugging info.
Since you're pretty close, fails sometimes and not others, you could probably just bump up your stack size a bit and be OK. This is done via a link option, covered in MSDN here[^].
Another option would be to dump this code out into a worker thread, which will have it's own stack and won't have the MFC overhead using alot of it.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
hi,
I am doing a MFC Program & going to add a Rich Text Box to a Dialog. I can add Rich Text to a Dialog Box.But after compile & Run,the Application is not DISPLAYED. Why like this??
can any body please reply me.
Thanks...
|
|
|
|