|
You can use tabs in a form view. There is an article in the Windows / Dialog section
http://www.codeproject.com/dialog/visualfx.asp
|
|
|
|
|
I found a much easier solution:
I have 2 member variables of CMainFrame (the 2 views):
CView* m_pScopeView;
CView* m_pXYView;
In CMainFrame::CreateClient, I do this:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect ClientRect;
GetClientRect(ClientRect);
m_pScopeView = (CView*)new CExtScopeView;
m_pScopeView->Create(NULL, NULL, WS_CHILD, CFrameWnd::rectDefault, this, SCOPE_VIEW, pContext);
m_pScopeView->OnInitialUpdate();
m_pXYView = (CView*)new CXYView;
m_pXYView->Create(NULL, NULL, WS_CHILD, ClientRect, this, XY_VIEW, pContext);
m_pXYView->OnInitialUpdate();
SetActiveView(m_pScopeView);
m_pScopeView->ShowWindow(SW_SHOW);
m_pXYView->SetDlgCtrlID(XY_VIEW);
m_pScopeView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
RecalcLayout();
return TRUE;
}
And when I select another view:
void CMainFrame::OnXYView()
{
SetActiveView(m_pXYView);
m_pXYView->ShowWindow(SW_SHOW);
m_pXYView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
m_pScopeView->ShowWindow(SW_HIDE);
m_pScopeView->SetDlgCtrlID(fActiveView);
RecalcLayout();
fActiveView = XY_VIEW;
}
This work fine exept that the toolbar is drawn 1 or 2 pixels under the normal position and so, there's no separating line between the toolbar and the form view. This is very ugly!
How can I avoid this ???
Thanks
|
|
|
|
|
You should not explicitly be calling OnInitialUpdate() you are asking for trouble there. You should write your own initializing funnction in this case. In addition this does not look like an easier solution to me - the link I have takes care of some of the details. SHOW_WINDOW is the key to switching between the views, but you still must map to the frame window and handle messages properly.
|
|
|
|
|
Ok, but I found this method in a book.
I forgot to tell you that I'm using FormViews.
I don't want to have a tab: the user must choose on the toolbar wich view he wants to be displayed. There is 3 totaly different form views.
So is there any simple way to create the 3 views at the same time (and initialize them) and then switch to the one the user select ??
Thanks for your help
|
|
|
|
|
What you were doing would work. Just put the showwindow in the handler from the button.
|
|
|
|
|
Yes that works, except that the toolbar is not draw correctly... This is really ugly !
I used the debugger and I saw that the CFrameWnd::rectDefault rectangle has strange values:
top and left = -2147483648
bottom and right = 0
Is that normal ???
|
|
|
|
|
I don't know - I wouldn't be doing what you are doing in the first place so it is difficult to say. I think it is flawed from the beginning.
Either avoid Doc/View entirely or expect problems when you tinker with it. You should try to make sure you add at least the view that was passed in the argument list in oncreateclient, for example, and use the class editor to try to add it to the framework. You should also test things like loading multiple times with different views, test the MDU etc, drag and drop functionality. Read up on the document templates as well. There is no really simple way to change it because it is set up to take the complex task of doc / view and throwing in some more views. It should be set up by Microsoft to be easier to add multiple views - but the fact is that it isn't.
|
|
|
|
|
Ok, I will try to look at all theses things !
Thanks a lot for your help
|
|
|
|
|
Hi all,
I want to open IE window with the URL i specify and also I want to position that window and define its height, width..can i do that..and if yes..how..can anyone show me some pointers or tutorials or ideas on this...
Thanks a lot in advance..
Himanshu
|
|
|
|
|
Use ShellExecute(...) API
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
This might work, but you'll want to test it thoroughly in any case:
DWORD dwProcId;
HINSTANCE hInstance = ShellExecute(...);
hWnd = FindWindow(NULL, NULL);
while (NULL != hWnd)
{
if (GetParent(hWnd) == NULL)
{
if (hInstance == GetWindowThreadProcessID(hWnd, &dwProcId))
{
MoveWindow(hWnd, ...);
break;
}
}
hWnd = GetWindow(hWnd, GW_HWNDNEXT);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi David,
Thanks a lot...but i cud not understand how to position the IE window and also how to define size of this IE window..Please help..
thanks a lot in advance
himanshu
|
|
|
|
|
Did you look at the MoveWindow() function? The parameters are self explanatory.
MoveWindows(..., left, top, width, height, ...);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
hiii,
thanks a ton...i did that....
regards
Himanshu
|
|
|
|
|
Hi Guys,
I have an app in which I open a com port (9600, 8, N, 1, N (or H/W)) in overlapped mode to an external device. Whenever I write data to that port all data I sent is "echoed" back to me. After that I do get the device's data as expected, so the device is definately receiving the data. The device also does not have this "echo" capability, so it is not the device that is sending my own data back to me, so the problem lies somewhere in the driver, etc.
Is it perhaps the way in which the port is setup and opened ? Or it this a known issue in Windows serial driver ? Any other ideas ?
Regards
OD
|
|
|
|
|
I need to fill the array asfollows
const float feature_scal_intervall_low[NR_FEATURES] = {
0.1,0.0,0.1,0.1,0.3 ,0.2,0.1,0.1,0.0,0.2 };
Getting Warning : warning C4305: 'initializing' : truncation from 'const double' to 'const float'
How to typecast above array?? Any Suggesstions.
Thanks in advance
Warm Regards,
KKRam
|
|
|
|
|
Numbers written in 0.1 format are treated as doubles, to get he compiler to treat them as floats write them as 0.1f
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Its always better to use a 'double' array instead of float. If you are very specific about float array, you can initialize it by explicitly type-casting each element as shown below.
const float feature_scal_intervall_low[ NR_FEATURES ] = { (float)0.1,(float)0.0,(float)0.1,(float)0.1,(float)0.3 ,(float)0.2,(float)0.1,(float)0.1,(float)0.0,(float)0.2 };
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi,
Is it possible to use the same Windows socket for listening (for new connections) and at the same time exchanging data (using the sendto() and recvfrom() functions)? Or must I have two separate sockets, and if so must the separate sockets also be bound to separate network ports? Just for the info, I am using WinSock 2 API functions.
High thanks in advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
A socket is bi-directional, so you can read and write on it.
|
|
|
|
|
Sorry, didn't read your message correctly. When you 'accept' a connection on a listening socket then Windows will automatically create you a seperate socket with which you communicate to that client. You don't need to worry what port this is on as its all handled by the 'accept' call.
|
|
|
|
|
You must have misunderstood me (could be partly my fault sorry), I meant if it is possible to listen for incomming connections (not to accept them) and simultaneously communicate (sending/receiving) with a non-connected client? For ex:
* socket S is created.
* bind S to network address with specific port.
* Create thread T.
* set S to listen for incoming connections
* meanwhile on thread T, socket S is sending and receiving messages.
Is the above situation possible?
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
I have a tree list control and I want to differentiate certain entries in it. How can I, for example, set text on an item to a different color or make it bold?
|
|
|
|
|
You can bold an item by setting the TVIS_BOLD style on the item. To change colors, use custom draw.
|
|
|
|
|
Inserting an item with bold text:
pTree->InsertItem(TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE, "text", nImage, nSelectedImage, TVI_LAST);
Setting an existing item's text to bold:
pTree->SetItem(treeItem, TVIF_STATE, NULL, 0, 0, TVIS_BOLD, TVIS_BOLD, 0);
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|