|
Thanks for your response but I don't use Visual Studio. I'm using Dev-C++ and I don't know if it supports the WTL (I'm new to WTL...). I will take a look
Thanks
|
|
|
|
|
cedric moonen wrote:
I'm using Dev-C++ and I don't know if it supports the WTL
Um, no neither do I. I have not tried to use it outside of Microsoft IDEs
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi,
To show the menu item in SSI application , Its Handler must be added.
I want to Inactive the Menu Item under some event .
Lets say on Clicking a button in
OnBtnShowClick ()
{
// Here i want to Inactive any Menu Item .
// Menu is ... File -> Show File , want to Inactive "Show File" Item
}
what should i do ?
Thanx
Regards.
|
|
|
|
|
You need an ON_UPDATE_COMMAND_UI() handler. Here's an example for a menu item named "Delete":
BEGIN_MESSAGE_MAP(CBaseView, CListView)
ON_UPDATE_COMMAND_UI(ID_ITEM_DELETE, OnUpdateItemDelete)
END_MESSAGE_MAP()
void CBaseView::OnUpdateItemDelete(CCmdUI* pCmdUI)
{
CListCtrl &ctrlList = GetListCtrl();
pCmdUI->Enable(ctrlList.GetNextItem(-1, LVIS_SELECTED) != -1);
} What this does is disable the "Delete" menu item if no items in the list view have been selected.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Its when the ON_UPDATE_COMMAND_UI(ID_ITEM_DELETE, OnUpdateItemDelete) is fired .
But i want to Inactive it in some other function that is doing calculation etc.
How can i ?
thanx
Regards.
|
|
|
|
|
void CBaseView::OnUpdateItemDelete(CCmdUI* pCmdUI)
{
pCmdUI->Enable(! m_bCalculating);
}
void CBaseView::Calculations( void )
{
m_bCalculating = true;
...
m_bCalculating = false;
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
the menu item is only visible when you display the menu, and this is when the ON_UPDATE_COMMAND_UI.
if you have toolbars with the same ID, the ON_UPDATE_COMMAND_UI will be called eventually, and the button will be enable ( or disable ) at that time.
in your "other" function, you will need to set a class variable that will indicate if the menu ( or toolbar item ) will be enable or not; and processed in the ON_UPDATE_COMMAND_UI handler.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
i am in a project and i would like to save the attributes from an xml file in another file.in that xml file we have results from some texts and we need to analyze them by a program in c++DOM but i need to save only one type of nodes and its attributes.If someone can show me an example of a program that make similar things i would thank him.
Thank you very much
one new student in c++
|
|
|
|
|
|
Hi to all,
I would like to create a CEDit derived class with the following caratteristic:
Every time the user digits a char in the edit box, the class should control
the value of that char and compare it with a defined list of allowed chars
If the char doesn't match the list, char should not be accepted and a MessageBeep should be prompt
Anyone can help me?
Thanks in advance
|
|
|
|
|
Insert New Class
give new name for class and derived it from CEdit by selecting it from combobox.
And write your validation code in OnChar() ( u have to add this fucntion thru class wizard WM_CHAR )
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Hi,
It is quite simpe to do: with Class Wizard, create your own class (call it CMyEdit for example) and make it inherits from CEdit. Then override the OnChar method (not 100% sure about the function name but I think this is good). In this function, compare the char entered with those in your list. If it is not allowed, don't call OnChar from the parent (CEdit::OnChar() ). Otherwise call it and it will add the char in the edit box.
You will probably need to add a function to send your list to the class also. Call this function in the initalisation of your dialog box that contains your edit control.
Now, to add your specific control, use the resource editor and paste a standard edit, and with class wizard, you will have the possibility to choose your class to be associated with the control.
That's it
Hope this helps
|
|
|
|
|
Thanks to the users who replied me
You're so great!
|
|
|
|
|
Just a heads up, if you do your verification in OnChar your users will be able to enter invalid characters via copy 'n paste. You are much better off handling the verification in the OnUpdate (EN_UPDATE) handler. Check out the edit controls section here on CP for validating edit controls for sample code.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I want to add a button on windows Save As dialogue tool bar. I need information (name, path) about current document (which send Save As dialogue). From any documents I want to save them automatically in a fixed folder(s).
Best regards,
Mihai
mihai_chioariu
|
|
|
|
|
I have custom draw a dialog as my app's main dialog. I also want my dialog support resizing, so I choose the resizing style in resource editor. And in order to hide the ugly resizing border, I also draw the resizing border by my own. But when my app lost it foucs, the ugly resizing border also appear!!
I also override the OnNcPaint, but seems useless.
So would any one give any advice? any comment is appreciate!
Thanks a lot. pls, now I really do not know how to do.
|
|
|
|
|
How to retrive the key state of modifier keys combined with an other key like Tab.
For example .. to retrieve Alt+Tab keystate. ie. Alt-press +Tab press + Tab release + Alt release ??
Are there any ways...
Plz let me know
Thank you
vidhya
|
|
|
|
|
GetAsyncKeyState Function
The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
|
|
|
|
|
Hi, I need to upload TEXT files to an IIS server(ASP.NET, c#) from my MFC code. I also will be writting that code to accept the files at the server end. Can some one suggest how I can go ahead and upload files to the server.
Mayank Goyal
|
|
|
|
|
|
Well I do not have the option of using ftp as it is blocked I need to do it with HTTP only.
Mayank Goyal
|
|
|
|
|
|
Hello
I have a MDI application. Usely the user can open more then one document (CDocument) at the same time. Now I will open just one document at the same time. How can I block to open a secound document?
thanks for help Ernst
|
|
|
|
|
Are you wanting your MDI application to behave like an SDI application?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello David
I will no change to a SDI. I will just open one document (with the same template class) at the same time.
regards Ernst
|
|
|
|