|
OK, you'll have to pardon my lack of knowledge but doesn't EnableWindow() actually enable/disable the entire window? Where as I'm looking to enable/disable only a specific control in the window. Unknowingly i did:
void CPro1WinTUSDlg::OnMainDataRadio()
{
EnableWindow(IDC_EDIT1==TRUE); // or FALSE
}
As you know, whis doesn't produce the correct results. It actually disables my entire program, or at least locks it up (heh).
Sooooo, am I doing something wrong or do I need to use a different function?
Thanks!!!
Digital Khaos
"Every problem has a solution"
|
|
|
|
|
Yes, you want to disable the control, which is also CWnd derived. So you need to create variables that map to your controls and then call EnableWindow on them.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Do this:-
GetDlgItem (IDC_EDIT1)->EnableWindow(FALSE)
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I tend not to use GetDlgItem, but you're right, given the method you want is in the base class, it's as good a way of doing it.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Yeah, true. After raeding a couple of articles by Joe Newcomer I have always tried to avoid GetDlgItem and UpdateData in my code, specially being a big fan of Joe, that I am.
A lot of people seem to forget that we can use class wizard to create control variables for our dialog controls. I mean most people would have associated CStrings with text boxes but how many associate an edit box with a CEdit?
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
It was Paul DeLascia who pointed it out to me, in an MSJ article.
Nish [BusterBoy] wrote:
I mean most people would have associated CStrings with text boxes but how many associate an edit box with a CEdit?
I almost *always* associate with a control, not a variable. Then I can roll my own data validation, which is always better than the rubbish MFC comes out with.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I use GetDlgItem and UpdateData all over my code for too many years. I haven't read Joe's writings on why they're bad. Can you briefly tell me the problem?
I guess it's habit - it's how I was shown a long time ago. It appears to work well though. Is it considered bad style now?
thx
|
|
|
|
|
See these two articles by Joe :-
http://www.codeproject.com/cpp/nogetdlgitem.asp
http://www.codeproject.com/cpp/avoidupdatedata.asp
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
What if I want to add,delete,update resources in my exe file on Windows 9x.
The APIs BeginUpdateResource only work on WinNT and others.
So is there any way that my exe file can update resources of another exe.
Plz help me if you know.
In my dream, I was dorwning in my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Erik Kallen has written an impresive clone of this APIs working in Win9x systems. Check his article Updating Resources on Win9x.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanx
In my dream, I was dorwning in my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
Hi Guys,
i am creating an app with a doc/view architecture. The base class of my view class is CListView. Now i am using the InsertColumn function of CListCtrl. After that i am inserting some strings with the InsertItem function. The problem now us that i am changing the font, and the font of the Column also changes. WHY ?? I want that the Column Font stay always same and only the inserted String font wwould be changed...
Please see code:
void CFVCtrlView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
CListCtrl &lCtrl=GetListCtrl();
lCtrl.InsertColumn(0,"Header",LVCFMT_LEFT,300);
lCtrl.ModifyStyle(0, LVS_SORTASCENDING | LVS_REPORT | LVS_EX_FULLROWSELECT );
lCtrl.SetBkColor(RGB(160, 184, 207));
}
.
.
.
void CFVCtrlView::SetFonts()
{
CListCtrl &lCtrl=GetListCtrl();
CFont *font=(CFont *)this;
font->CreatePointFont(100,"arial");
lCtrl.SetFont(font);
lCtrl.InsertItem(1,"Hello World",0);
}
Please help if anybody can...
Its really urgent.
regards
sonu
|
|
|
|
|
It's really obvious when you think about it - you've set the font for the list control, so the list control uses that font.
I don't know of any way to fix this apart from making the list owner drawn and storing a font, or font details, for each cell that doesn't use the standard font of the control as a whole. That doesn't mean there *isn't* another way, I've never tried to do what you're doing.
Chris's grid control in a form view may provide the answer, I'm not sure if it does per cell fonts or not.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
How can I change the title caption of a dialog (CDialog) object?
I want to do the following:
CSetupDlg::OnShowSummary()
{
CString sMyTitle;
CSummaryDlg dlg;
// Somehow, set the title of the Summary Dialog
// with sMyTitle, today's date, or "The Summary is..."
dlg.doModal(); // I might use modeless case - must work both ways.
}
Thanks all!
Happy Holidays (BTW, http://www.crackermatic.com was funny )
|
|
|
|
|
SetWindowText on the dialog.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
If I pass in the "text" I want to use, I have no problem:
CEntitySummaryDlg::OnInitDialog()
{
SetWindowText(m_captionText); // m_captionText initialized in constructor.
// blah, blah, ...
}
However, I wanted to set the caption text before the call to DoModal() in my calling routine. I guess this is not possible as CEntitySummaryDlg dlg has yet to be created.
Thanks, I think I can work with this.
Johnny
|
|
|
|
|
john john mackey wrote:
However, I wanted to set the caption text before the call to DoModal() in my calling routine. I guess this is not possible as CEntitySummaryDlg dlg has yet to be created.
That's correct - you'd need to make a variable in the class, set it before creation, and use that variable to set the text in OnInitDialog.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Here's a general solution to performing dialog initialization when using modal/modeless dialogs.
- Put your initialization code in a member function, eg: CMyDialog::initialize().
- Add a command handler macro for a custom command (eg: WM_USER + 1), which executes initialize().
- In your dialog's OnInitDialog(), post a WM_COMMAND with WPARAM = (WM_USER + 1).
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
I must be missing something - how is this better than just calling the function, or putting the code in OnInitDialog ? I understand that posting the message causes it to occur after the init message is processed, but the usual thing is to call the base method *first* so that the dialog is initialised.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
If you subclass controls, the initialization can fail in the case of modeless dialogs, since the controls' windows aren't always created when a modeless dialog's OnInitDialog() executes. Hence the deferred initialization.
The problem doesn't exist with modal dialogs, but because there's no harm in deferring initialization for modal dialogs, the same method (no pun intended) can be used.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi Guys,
how can i get the font face name if i just have the file name of the font.
For Example: i have the file "Comic.ttf" and i want to find out the font face name. How can I ????
Please Help me its urgent...
regards
Sonu
|
|
|
|
|
this is silly. i dont know the answer. but i found that all font file contain their name in the first line. so open and read the file charecter by charecter till u get enf of line and u can get font name. i am sorry for being stupid.
Ganesh Ramaswamy
|
|
|
|
|
I have checked your idea it but the fontface name is not always in the first line and that´s not the solution. Please try an another solution.
How can i get the file Properties ???
Maybe that will help...
Thanx anyway....
regards
Sonu
|
|
|
|
|
Please Help me with this Problem !!! Its really Urgent. I am going Angry !!!
regards
Sonu
|
|
|
|
|
I have overriden the OnEraseBkgrd function of CStatic
also postcreatewindow and drawitem are overriden, this is for the control of my static text box so i can draw directly to the box.
I would like to know how to update the box, after OnPaint does not call the OneraseBkgrd function which is where the drawing code is contained. I'm wondering if i could send a windows message with WindowProc(WM_ERASEBKGND,1918,0); could u tell me if this is the best way to update the box's content as i think it may update the entire window.
Actually that doesnt want to work... Please Help!;)
|
|
|
|