|
Hi Experts,
I want a CListCtrl with Checkbox and Report View in which some item should be selectable and remaining should not.
How can I do that?
|
|
|
|
|
Try handling the LVN_ITEMCHANGING[^] notification, examine which item is about to change anf if it is one that is not allowed, return TRUE to prevent the selection/checking. Hope that is what you need...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
But I want also make these item different(Not Selectable) from other List Item(Selectable).
|
|
|
|
|
Then you will have to go with ownerdrawn[^] items i believe.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi to All,
In regards to previous problem of mine,...I have made an overloaded construtor of dialog class in dialogB...Now while creating the object of the dialog , I am passing the variables...No problem the overloaded contrctor of dialogB calls fine. But again, the default constructor is getting called. Why so?
my code line to create the dialog is...
dialogB obj = new dialogB(&m_boardMainPage,&m_portMainPage,&m_extMainPage);
obj.DoModal();
I need to create the dialog with overloaded constructor (in order to pass some valued to that dialog)..Please help me.
-----------------------------
I am a beginner
|
|
|
|
|
You have classA, and classB inheriting from that.
You make a new classB, and both classB::classB() and classA::classA() are getting called?
This is not a bad thing. This is a GOOD thing.
Imagine if this was not the case. CDialog is a slightly complex class. You make a new dialog. Your constructor would have to do all the special work of your new class. AND ann the special work of a CDialog. AND all the special work of a CWnd. AND all the special work of a CObject.
(It's turtles all the way down).
If you want to control which CDialog constructor gets called, you need to do the following:
CMyDlg::CMyDlg (CWnd *pParent)
: CDialog (IDD_MYDLG, pParent)
{
In addition - the base class constructor gets called first. Again, imagine if it was the other way around. All the stuff not included in the inheriting class would be uninitialised.
I hope that helps,
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
A guess what's causing this behavior: If you pass a variable of class dialogB in a function call, the default constructor will be called to create a second instance of dialogB.
If this is happening and you want to avoid this behavior, pass the address of the dialogB object, rather than the object itself.
|
|
|
|
|
Hi to All,
Could anyone please help me with my following problem.
Basically, I need a way to pass values between different dialog. Following is exactly what my requirement is.....
I have a property page, from where I am opening an another dialog (modal), to enter some values. Now I want those values back in my property page, once the user closes the modal dialog. PLease help me with it.
Thanks in advance.
-----------------------------
I am a beginner
|
|
|
|
|
You can use 'SendMessage()'function
|
|
|
|
|
thanks for your reply..
Could u please elaborate a little bit.I am new to MFC
Thanks
-----------------------------
I am a beginner
|
|
|
|
|
This is pretty classic MFC stuff.
You have a propert page called CMyPropertyPage. It has two controls on it.
1) A button called "press me". Use class wizard to associate this with a function OnPressMe.
2) An edit control (or a static control, I don;t care). Again, classwizard, associate with a CString called m_hrishiS.
When you press the button, you want a dialog box to pop up. This box has been made already, and is called CMyDlg. This has a single edit control on it. Using class wizard, you've associated this edit control with a class member m_MyString.
So, your function would be like...
void CMyPropertyPage::OnPressMe ()
{
UpdateData (TRUE);
CMyDlg dlg (this);
dlg.m_MyString = m_hrishiS;
if (dlg.DoModal () != IDOK)
return;
m_hrishiS = dlg.m_MyString;
UpdateData (FALSE);
}
Now go back to your book, or the MFC manual pages, and look up UpdateData. Also read the code for DoDataExchange that has been created automatically for you, and look up DDX_Text in the manual.
I hope this steers you in the right direction.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
A heartfelt thanks to you
I got it done.
Thanks a lot again.
-----------------------------
I am a beginner
|
|
|
|
|
I am using following imports:
//Mircorsoft Office Objects
#import \
"C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE12\mso.dll"\
rename("DocumentProperties", "DocumentPropertiesXL")\
rename("RGB", "RBGXL")
//Microsoft VBA Objects
#import \
"C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb"
//Excel Application Objects
using namespace Office;
#import "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"\
rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL")\
rename("DocumentProperties", "DocumentPropertiesXL")\
rename("ReplaceText", "ReplaceTextXL")\
rename("CopyFile", "CopyFileXL")\
exclude("IFont", "IPicture") no_dual_interfaces
Excel::_ApplicationPtr XL;
Excel::_WorkbookPtr book;
Excel::_WorksheetPtr sheet;
By using for loop ,able to get all workbook names.Using following code iterating through item, getting all workbook names.
book = XL->Workbooks->Item[1];
In case of worksheet, i am not getting the name of worksheet.There is no such option as workbook.
Able to point to particular sheet, but name option is not there.
sheet = XL->Workbooks->Item[1]->Sheets->Item[1];
I want to retrieve whole list of worksheets present in workbook.
Googled but I didn't get any clue.
If there is any option, please give me clue.
Thanks in advance.
Gtag.
Hey if any one knows, please give me clue.
modified on Tuesday, September 29, 2009 9:29 AM
|
|
|
|
|
// --- Print worksheet names
Excel::_WorksheetPtr p_sheet;
m_lngWorksheets = m_xLBook->Worksheets->Count;
TRACE("Number of Worksheets is <%d>\n", m_lngWorksheets );
for ( ico=1;ico<=m_lngWorksheets;ico++ )
{
p_sheet = m_xLBook->Worksheets->Item[ico];
_stprintf(p_szBuffer, _T("%s"), (LPCTSTR)p_sheet->Name);
TRACE("Worksheet %d Name is %s\n", ico, p_szBuffer );
}
|
|
|
|
|
On BN_CLICKED, I do:
hCombo = GetDlgItem(hwnd,COMBOBOX_WAVEFORMTYPE);
EnableWindow(hCombo,FALSE)
to attempt to disable my combobox. the odd thing is that it appears disbled since it's grayed out. But, I can still pull down the arrow and see the contents. If I do this on WM_CREATE:
hCombo =
CreateWindow(
"combobox", // Either "edit", "button", "combobox", or "static"
"", // Can be set to ""
CBS_DROPDOWNLIST|CBS_UPPERCASE|WS_CHILD|WS_TABSTOP,
0, 0, 0, 0, // Positioning information
hwnd, // The parent window handle
(HMENU)(COMBOBOX_WAVEFORMTYPE), // The Identifier
hInst, // Global application instance
NULL); // Additional data, not required
SendMessage(hCombo,CB_ADDSTRING,0,(LPARAM)"Square Wave");
SendMessage(hCombo,CB_ADDSTRING,0,(LPARAM)"Triangle Wave");
SendMessage(hCombo,CB_ADDSTRING,0,(LPARAM)"Saw tooth");
EnableWindow(hCombo,FALSE);
It works fine! What is the difference? This problem is killing me. Thanks
|
|
|
|
|
The best way is to add a control variable to your combo box and call m_Combo.EnableWindow(FALSE);
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
It looks a lot like he's using Win32 rather than MFC...
But your point is correct!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Yes, I am using win32. Is there a way do do it without resorting to MFC? Thanks
|
|
|
|
|
The frame work is not the issue. Rajesh's point is that you should keep the window handle to the created combobox.
Whether you do that with a HWND in Win32, or a CWnd / CComboBox in MFC is not really the issue.
If it is created as part of a dialog, then that's a bit harder.
I'd turn to spy++ and see what is different on the control in the two scenarios you describe.
I really don;t see the problem with:
HWND hCombo = GetDlgItem (hDlg, IDC_MYCOMBO);
if (hCombo) EnableWindow (hCombo, FALSE);
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Thanks for your help. Actually, the problem was pretty stupid. I'm new to win32 programming... I had invoked WM_CREATE on my own, effectively creating 2 instances of each child window. I didn't realize that WM_CREATE was called by the window's manager upon client creation, my bad. Again, thanks for answering my question.
|
|
|
|
|
I am still futzing with my simple two-pane splitter – left pane displays tree control and the right pane displays the views selected in the tree control – parent node and some children nodes( one AVI stream and four selected frames from the AVI).
The children nodes are bitmaps - pages in tab control. The different bitmap HBITMAP structures are in the associated document attached via popup menu. Sound complicated – but that is not the issue.
Here is my dilemma – I can display only single tab bitmap. As long as I have “selected “ only one I am OK. As soon as I select another one the first one won’t display again when the tab is selected.( The bitmap selections are different frames from AVI steam).
I do verify the actual width of the attached bitmap / frame and it is OK.
Please ignore the "->" is is correct in the code just not here!
m_bmpInfo = m_CCCC_ParserDoc->m_bmpInfo[m_BitmapIndex];
VERIFY(m_bmpInfo->bmWidth > 0);
I do draw (stretch) the bitmap and it returns OK, but no bitmap in view!
if(!pDC->StretchBlt(0,00,rect.right,rect.bottom,&dcMemory ,
0,0,bmpInfo->bmWidth,bmpInfo->bmHeight,SRCCOPY /*WHITENESS */ ))
TRACE("\n Failed pDC->StretchBlt");
else
{
TRACE("\n Draw Bitmap OK ");
I tried MoveWindow – I had some issues with it when deleting views in splitter frame, but it did not do the trick.
I tried ShowWindow – no luck.
The bottom line is – the bitmap structure is correct, the bitmap draws but does not show.
I am not looking for solution, just an advice what else I should try to find out where are these bitmaps.
Any constructive suggestion is as always appreciated.
|
|
|
|
|
Vaclav_Sal wrote: Please ignore the "->" is is correct in the code just not here!
Please use the code formatting tags on your message, and then we will be able to understand better what your code is trying to do.
|
|
|
|
|
I am using all the formatting options and do not understand why this is happening with my text. Besides it is not that important in this case to resolve this issue. It is not my syntax which is the problem.
Thanks anyway for replying. Appreciate that.
|
|
|
|
|
Hi,
I was making a tests and i need to change my computer date and time ...
After return it to the correct date my compiling allways compile all C++ programs ...
When I start a program directly without compiling i receive a message informating that is out of date ...
How can correct this ... ?
Tanks for help ...
|
|
|
|
|
Chances are you have one or more project files whose time are set to the future. Find out which ones they are and "touch" them or set their times to be the present and then one more build should have everything up to date.
|
|
|
|
|