|
Hi,
I'm building an MFC app (not everyone has moved to .NET yet, in fact I have decided to skip .NET and wait for the next framework, due any time now)that has a splitter window with two main panes, left and right. In each pane I have a tab control. The left tab control has a tree control in each tab. The right tab control will have different controls in each tab, depending upon the selection in the left tab control's selected tree and item.
That's all fairly specific, but my question is quite general. What is the best way to cause events in one pane of a splitter (in the case selecting a treeitem) to make things happen in another pane. In a more simple example, how would events in the left view cause changes to the right view?
I ask this because normally views do not know about each other, only about their parent frame. What's the most elegant way to link the views? (NB, I'm not asking what are the tree notification events, I know those).
|
|
|
|
|
Mister Transistor wrote:
That's all fairly specific, but my question is quite general. What is the best way to cause events in one pane of a splitter (in the case selecting a treeitem) to make things happen in another pane. In a more simple example, how would events in the left view cause changes to the right view?
I ask this because normally views do not know about each other, only about their parent frame. What's the most elegant way to link the views? (NB, I'm not asking what are the tree notification events, I know those).
Both views are linked to the same CDocument, right? I'd follow the same approach as for document data changes in general.
I'd add the following to the document:
1. some member to represent the shared state (i.e.: 'selected item')
2. a member function to get the shared state
3. a member function to alter the shared state
4. an enum with identifiers to be used in UpdateAllViews notifications, including an identifier for "shared state changed".
Then, the view that changes the selected item simply calls the method in 3, which is implemented as follows:
class YourDocument : public CDocument
{
[...]
public:
enum UpdateHints {ANY_CHANGE, SELECTED_ITEM_CHANGED, ...};
void YourDocument::ChangeSelectedItem(ItemIdentifier item, CView* pRequestingView = NULL);
};
void YourDocument::ChangeSelectedItem(ItemIdentifier item, CView* pRequestingView )
{
m_itSelected = item;
UpdateAllViews(pRequestingView, SELECTED_ITEM_CHANGED, NULL);
}
The OnUpdate implementation for the right view can do something like:
void RightView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
switch (lHint)
{
default:
Invalidate();
break;
case YourDocument::SELECTED_ITEM_CHANGED:
OnSelectedItemChanged();
break;
[...]
}
}
void RightView::OnSelectedItemChanged()
{
[...]
[...]
}
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose,
many thanks, your proposal is logical and relatively simple and elegant - I like it!
regards
Andrew
|
|
|
|
|
Does anyone know how to create a version info, using VERBLOCK and VERHEAD
I need to create my own version resource and call updateresource to put in new values into an executeable
(ie. making Comments, InternalName, OriginalFilename, ... etc)
ANY HELP WOULD BE APPRECIATED sample code ><
Thanks
Mepho
|
|
|
|
|
This type of resource is usualy not to be modified once you set it. Why would you want to change it from within your program ? I use the following code lines in the "resource.rc" file:
#ifndef _MAC
////////////////////
// Version Info
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,0
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
{
BLOCK "StringFileInfo"
{
BLOCK "041804b0"
{
VALUE "Comments", "<text>\0"
VALUE "CompanyName", "<text>\0"
VALUE "FileDescription", "<text>\0"
VALUE "FileVersion", "0.0.0.0\0"
VALUE "InternalName", "<text>\0"
VALUE "LegalCopyright", "<text>\0"
VALUE "LegalTrademarks", "<text>\0"
VALUE "OriginalFilename", "<text>\0"
VALUE "PrivateBuild", "0\0"
VALUE "ProductName", "<text>\0"
VALUE "ProductVersion", "0.0.0.0\0"
// here you can insert other values of your own, like:
// VALUE "DISCLAIMER", "Your own Disclaimer\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x418, 1200
}
}
#endif // !_MAC
|
|
|
|
|
Hi there ! I want to load a bitmap from inside my application in order to display it on a dialog box !
In "resource.h" file i wrote:
"#define IDB_BITMAP_SPLASH 500"
In "resource.rc" file i wrote:
"IDB_BITMAP_SPLASH BITMAP "SPLASH.BMP", where SPLASH.BMP is the name of my bitmap file.
In "main.cpp" file i wrote:
"HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle.
The problem is that this function is returning NULL. I've also tried with "LoadImage()" and "LoadResource()" functions. None of them work ! I've tried instead of MAKEINTRESOURCE to simply write "Splash.bmp" as if i were loading it directly from the file. Does not work !
Can anyone help me ? I'm using Windows 2000 SP4 and i'm not writing this in MFC, but in simple Win32API.
ThankYou !!!
|
|
|
|
|
|
I use Bloodshed Dev-C++ IDE with MINGW compiler, so i don't have a resource editor !
|
|
|
|
|
ThEdreamMaker wrote:
"HBITMAP hBitmap=(HBITMAP)LoadBitmap(hInst,MAKEINTRESOURCE(IDB_BITMAP_SPLASH));", where "hInst" is my application's instance handle.
The problem is that this function is returning NULL
Have you checked GetLastError() ?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
GetLastError() returns 1814, and FormatMessage() for this error number says: "The specified resource name cannot be found in the image file."
|
|
|
|
|
The problem was that hInst was NULL ! Thank you anyway !!!!!!!
http://gxsoftware.idilis.ro
|
|
|
|
|
Hi !
We Need a custom activex control so we are looking for a programmer
any one having experience in developing activex control should email us for further details
email : asim.khan007@gmail.com
Thanks
|
|
|
|
|
And what's in it for us?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
And what's in it for us?
I Believe , MONEY
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Isn't the collaboration / testing forum introduced for that?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Is there someone know the windows nt timestamp format?I want to write code to convert the date/time(yy::mm::dd/hh::mm::ss) into windows nt timestamp format.Who can tell me something about windows nt timestamp format?
Thanks!
|
|
|
|
|
What timestamp format are you talking about?
Don't try it, just do it!
|
|
|
|
|
I understood yesterday.Thank you!
|
|
|
|
|
CTime::GetTime might give you what you want.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
No,It can't.You don't understand me.
Now ,I understand.
Ask you a question.
What's the meaning of 'splode'?
|
|
|
|
|
How about clarifying your original post, and elaborating on the solution you came up with instead of leaving us all in the dark? Maybe it'll help someone in the future.
If CP forums contained nothing but posts similar to yours, it would become absolutely useless. Share the knowledge!
|
|
|
|
|
I'm wondering if the less value 'n' get, the less time tooltip appears needed?
CTooltipCtrl::SetDelayTime(n);
...always look on the <blink>bright
side of life...
(Whistle)
|
|
|
|
|
Per MSDN:
Call this function to set the delay time for a tool tip control. The delay time is the length of time the cursor must remain on a tool before the tool tip window appears. The default delay time is 500 milliseconds.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I want to seperate a video file (mpeg2) into three different files. The content of the first file should be I-Frames, P-Frames in the second file and B-Frames in the third frame. In the next step the three files should be manipulated and merged into one file again. The idea is to simulate a air-interface.
My problem is still to seperate a file into three single files.
I hope someone has an idea.
If there is a C-Code available it would help a lot.
Armin Schlögl
|
|
|
|
|
hey...
My application draws a plots data given at run-time ...but having problem in properly scaling time(in seconds) along x-axis
|
|
|
|