|
I have an SDI application, with a splitter window that have in left view an CTreeView and right side an CListView.In each one I have some items. I override PreTranslateMessage in each one to be able on tab key to move focus from tree to view and viceversa :
BOOL CMyTree::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB)
{
CMyListView* pView = (CMyListView*)pChild->GetMyListView();
pView->SetFocus();
pView->GetListCtrl().SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
return TRUE;
}
return CTreeView::PreTranslateMessage(pMsg);
}
I see that the focus has moved.
Somewhere in menu I have a delete menu that could delete items from tree or from listview.
Let's say that I'm in treeview. I press tab and I see that the focus has moved on listview. When I try to delete an item I see that I delete an item from treeview not from list view .... so, from some reason, the focus remained in treeview ...
The the deletion goes well only when I move the focus from tree on list view by click with mouse in list view ...
My question is, is enough to call SetFocus(); to move an focus from tree view to listview ?
|
|
|
|
|
How does your command handler for the delete operation determine whether the treeview or the listview has focus? You haven't provided that code. As a user, my expectation would be that the delete operation should be deleting the item in the control that has focus. Though I guess a case could be made for deleting anything that is selected regardless of focus.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
Of course that program delete the item of window that have the focus ... the problem is : I am in the listview, I select 2 items, and when I go to main menu, click on delete item from menu, program wants to delete an tree view item, not list view items ... I try to make a little demo, to see what is happend.
|
|
|
|
|
If we could see your 'delete' code, that could help. That command handler code could delete items from either control.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
void CMyTree::OnEditDelete()
{
CString sItem,sMessage;
CTreeCtrl& Tree = GetTreeCtrl();
HTREEITEM hSelectedItem = Tree.GetSelectedItem();
if(! hSelectedItem)return;
sItem = Tree.GetItemText(hSelectedItem);
sMessage.Format(_T("Are you sure you want to delete '%s' item ?"),sItem);
if(IDYES != MessageBox(sMessage,NULL,MB_YESNO | MB_ICONWARNING))return;
}
theApp.UpdateAllViews(NULL,CMyApp::UH_ITEM_CHANGED);
}
the code for delete an item from list view is similar, but at the point when I have confirm message-box, the message said to me that want to delete item from listview, not from tree view ....
I don't know if I'm was understable, but thank you anyway for your interest !!!!
modified 26-Nov-11 1:17am.
|
|
|
|
|
[CListCtrl::DeleteItem] Deletes an item from a list view control.
CListCtrl* pmyListCtrl;
int nCount = pmyListCtrl->GetItemCount();
for (int i=0;i < nCount;i++)
{
pmyListCtrl->DeleteItem(0);
}
|
|
|
|
|
Looking at (ATL) code of mine for handling tabs, and which uses <code>GetDlgItem</code> rather than <code>SetFocus</code>, the only difference I can see is that I have a call:<pre>// Now select all like normal tab behaviour
SendMessage(hNew, EM_SETSEL, 0, -1);</pre>at the end. Presumably as my tabs have edit controls on and the cursor needs setting up. So unless there's a parallel with your views e.g. ensure, say, a node or list item has focus or is other wise set up, I'd agree with Chris and wonder about the code doing the deleting.
|
|
|
|
|
Hi all,
I'm new with Win C++ API, I'm trying to create an application that lives as a trayicon, and my purpose is to capture the mouse over event when hovering over the icon..this should launch a new window. I've had some try by using the WM_MOUSEHOVER message on the window handler relative to the NOTIFYICONDATA object, but it seems to have no effect. Am I using the message in a wrong way? Is there some specific API or implemaentation to manage this?
Thank you all in advance!!
|
|
|
|
|
[ Here ] are a couple of good implementations.
|
|
|
|
|
Hi,
This link will help you.
http://www.codeproject.com/KB/shell/ctrayiconposition.aspx
-- modified 25-Nov-11 4:09am.
|
|
|
|
|
Please make your links clickable, like this[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi developers,
I requires to handle OnClose handle of a form view. I am building a heavy tree on it( based on thread ), and while doing that if i closed that form, application was getting crash, because that tree control has been destroyed.
So that I have to capture it's close event so that I can prevent this event to proceed, i.e. to close that form.
Thanks In Advance.
Amrit Agrawal
Software Developer
|
|
|
|
|
When you close that form, the syst will call its destructor so if you wanna handle the prob go to the
YourFormClass()::~YourFormClass( )
{
}
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
|
I totaly agree with u in case the user is running an SDI application but what if it is a MDI application ?
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Yes, [MSDN] says: "To destroy an MDI Child window; use the virtual member function CWnd::DestroyWindow . Do not call the global ::DestroyWindow API to destroy an MDI Child window."
It goes on to say: "In the case of C++ Windows objects that do perform auto-cleanup, you must call DestroyWindow. If you use operator delete directly, the MFC diagnostic memory allocator will alert you that you are freeing memory twice (the first call to delete as well as the indirect call to "delete this" in the auto-cleanup implementation of PostNcDestroy)."
|
|
|
|
|
You scored Hight .
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Hi all,
I am trying to run one console based application,
Where i reading a argument from command line.
If i press ENTER ,i am writing the sane to the command line.
How can i print the same without pressing ENTER.
Can i execute the second printf without pressing ENTER
This is the code i am using
int main(int argc, char* argv[])
{
int aNumber;
char aChar;
printf("\nEnter a number:");
scanf("%d", &aNumber);
printf("\nThe number entered is %d\n", aNumber);
return 0;
}
Thanks
Sharan
|
|
|
|
|
On Windows, you can utilise the _getch function, which is exposed by conio.h . On *nix, you can use tcsetattr to turn off canonical mode, which is exposed by termios.h , which'll offer immediate feedback when reading.
|
|
|
|
|
Hi , Use this modified code.
Modified code,
#include <conio.h>
int main(int argc, char* argv[])
{
int aNumber;
char aChar;
printf("\nEnter a number:");
scanf("%d", &aNumber);
printf("\nThe number entered is %d\n", aNumber);
getch();
return 0;
}
|
|
|
|
|
Hi,
try to run this program from the windows command prompt..
|
|
|
|
|
We have an application developed using MFC in Visual Studio 6.0. which is a client-server based architecture using TCP/IP Sockets.
The server application reads data from text files and binary (which acts as database). Based on the Network configuration, the client application that runs in various stations (PCs connected within the LAN Network) connects to the Server application. Exchange of data then takes place between the server and various number of clients that are connected to the server. All the communication happens using the TCP/IP socket protocol.
Now there is a requirement to convert the existing architecture to web based architechture such that the Server is installed in a remote PC. The clients from various geographical locations have to be connected to the Server.
Please provide me guidelines how to convert the existing architecture to web based architecture.
|
|
|
|
|
You need to convert your server into a web server using one of the web architectures available. If you are familiar with Microsoft products then ASP.NET[^] would be a good choice.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi,
First you need to convert your Server portion to a web architecture.You can use ASP.Net and SQL Server. Then develop the client in Visual c++ or something else, the client must communicate to the database.
|
|
|
|
|
"How to change my app from using Internet Protocol, to an Internet based one"
Er, anyone else see a problem here?
manoharbalu wrote: Now there is a requirement to convert the existing architecture to web based
architechture
So you can market it as 'Cloud' no doubt?
Just leave it as it is, it is already an internet based app and slap 'Cloud' on the box to fool the muppets and marketing types who use words without understanding what they mean.
==============================
Nothing to say.
|
|
|
|