|
My suggestion is to use List ctrl instead of Listbox so that the item can be displayed in two columns.
nave
|
|
|
|
|
hey thnaks for ur resposne
but how do i use listctrl. do u have any example?
|
|
|
|
|
thathvamsi wrote: listctrl
Add a list control from the toolbox.
Create control variable of the list control and then use InsertItem etc to create columns of the list control in the OnInitDialog()......
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
See
<br />
m_List1.InsertColumn(0,"Test2");<br />
m_List1.InsertItem(0,"Test1");<br />
maybe it is some helpful to you also you can see examples in msdn from CListCtrl Class[^]
|
|
|
|
|
How do I create columns?
I have created a listcontrol using toolbox and have chosen the property to be of report view and then created a variable called m_recd for it. and then now what message function do i add and what do i do to create columns and then items.
I want to have 2 columns. How do I add title to it?
Can u send some code snippets if possible.
|
|
|
|
|
m_recd .InsertColumn(0,"Column1",LVCFMT_LEFT, 100 );// first column
m_recd .InsertColumn(1,"Column1",LVCFMT_LEFT, 100 );// 2nd column
nave
|
|
|
|
|
See
<br />
LV_COLUMN lvc;<br />
lvc.mask = LVCF_FMT | LVCF_WIDTH |LVCF_TEXT| LVCF_SUBITEM;<br />
lvc.fmt = LVCFMT_LEFT;<br />
lvc.pszText = CA2T("Col1");<br />
lvc.cx = 50;<br />
<br />
m_List1.InsertColumn(0,&lvc);<br />
m_List1.InsertColumn(1,"Col2");<br />
m_List1.InsertColumn(2,"Col3");<br />
<br />
m_List1.InsertItem(0,"One");<br />
m_List1.InsertItem(1,"Two");<br />
m_List1.InsertItem(2,"Three");<br />
|
|
|
|
|
I am doing secondary programming on a CAD software with its API, and need to execute the command in the context menu of the CAD software programmatically, just like I manully right click a item and select a command.
I don't have any clue to do that now, and if it takes too many words to explain, could you please recommend me some material to read.
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
You have to chk that in the CAD api itself to see whether they provide such an extendebility.
cheers..Milton KB
|
|
|
|
|
Oh, it turned out to be NO, which is also why I ask question here.
Because there is no corresponding API, I hoped I could execute the command in the context menu in program to do the same thing as the user dose in interactive environment.
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
If the API doesn'tprovide such a functionality, then it is impossible for a user code to inject into another applications binary ( though it is possible to some extent through api hooking and ijecting code, its not that practical).
cheers...milton Kb
|
|
|
|
|
I make new style webbrowser.
I use CWebBrowser2 class. My program is dialog application.
I question. How can I know mouse click event when click on the webbrowser.
How can I know? plz help me..
I wanna sample source or detail description.
|
|
|
|
|
Hi,
I'm currently working on an embedded system which has an ethernet port and a TCP/IP stack running. I'm having some problems with a telnet TCP connection. I find that sometimes if I really hammer the TCP session with very regular commands the TCP connection seems to lock up because the PC fails to recieve an ACK packet thus halting data flow. Currently I'm using Etherial (a network packet sniffer application) to look at the packets the PC is sending and recieving, and it claims that my embedded system is failing to send an ACK packet occasionally, but I can't find any evidence of this in the embedded system. Is it possible that a packet that has been corrupted on the data layer, would be discarded before even showing up in ethereal?
Joel Holdsworth
|
|
|
|
|
Simple things first - try changing the network cable.
This could be caused by a poor connection affecting the magnetics - remember there is no such thing as ditigal electronics merely badly distorted analogue!
Elaine (quantised fluffy tigress)
|
|
|
|
|
Trollslayer wrote: there is no such thing as digital electronics merely badly distorted analogue!
Eww. I just had a nasty flashback to my Control Systems class in college.
Z-transforms, blech .
Software Zen: delete this;
|
|
|
|
|
I'm interested in a tutorial on how to build Vc++ apps with windows, buttons, etc. With examples, and (hope) free. Maybe, downloadable.
|
|
|
|
|
Other than just jumping in and getting your feet wet, do you have access to a bookstore, or perhaps a library?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
For a beginer isn't easy...
|
|
|
|
|
See Here[^] maybe it is some helpful to you
|
|
|
|
|
|
I think the simplest way to start with visual program building is to create a new project with VC6. VC7 and VC8 complicate matters a little, but the steps are basically the same. The following description is for VC6.
Start by creating a new MFC application (exe) project named "MFCTest" and select a dialog based application. Leave all the defaults if you are unsure what they mean. After VC6 has created your project build it. You should see 0 errors and 0 warnings. Run it and you should see a simple dialog.
Start by going to the resource view and display the "IDD_MFCTEST_DIALOG" dialog. Add an edit bot to it by selecting it in the tool bar ("ab|") and draw it inside the dialog. A box with the word "Edit" appears. Open its properties (RMB->properties or ALT+ENTER) and change the ID from "IDC_EDIT1" to "IDC_NAME". Add another one and change its ID from "IDC_EDIT2" to "IDC_ADDRESS". We will now setup these boxes when the dialog opens.
The definition of the dialog is in the file "MFCTestDlg.cpp". In line 91 you find the function "BOOL CMFCTestDlg::OnInitDialog()" which is the function called during the creation of the dialog and where you may setup items, like values in edit boxes and populate lists. This function starts by setting up the menu and the icons and then has a "TODO:" section where you add your code.
Add the line "CEdit* np=(CEdit*)GetDlgItem(IDC_NAME);" after the "TODO:" to tell the program to find the edit box with the identifier IDC_NAME and put its address in "np". Then add the line "np->SetWindowText("Abracadabra");" to set the text in the edit box. Do the same to the address box by adding the lines "CEdit* ap=(CEdit*)GetDlgItem(IDC_ADDRESS);" and "ap->SetWindowText("Mars");".
Now compile and run the program and you will have the edit controls setup by the time the dialog opens. Now, to get text when the user types it, we have to add a handler to be called when the text changes.
Go to the resource view and select the "IDD_MFCTEST_DIALOG" dialog. Then select the IDC_NAME box. Press CTRL+W (to invoke the wizard) and verify that the project is "MFCTest", the class name is "MFCTestDlg", and that the selected object ID is "IDC_NAME". Then select "EN_CHANGE" in the "messages:" box. The "Add Function" button will become available and you may select it and accept the proposed function name. The "EN_CHANGE" becomes bold, and the "Edit Code" becomes the default button. Click it and you will go to line 177 of "MFCTestDlg.cpp".
The created function "void CMFCTestDlg::OnChangeName()" will be called when the text in the IDC_NAME box changes. For this example we will get whatever text the user types here and put a reversed version in the IDC_ADDRESS box. insert the following lines in the function:
CEdit* np=(CEdit*)GetDlgItem(IDC_NAME);
CEdit* ap=(CEdit*)GetDlgItem(IDC_ADDRESS);
CString s;
np->GetWindowText(s);
s.MakeReverse();
ap->SetWindowText(s);
First the edit boxes are found. Then a new string is created and filled with the contents of the name edit box. Then we reverse it and put the result in the address box. Note that setting the text in the address box would invoke its EN_CHANGE message, and so if you did the same in the handler for the address (if we had any) as we are doing in the name you would end up with an infinite loop of one handler invoking the other indefinitely.
If you want to add variables to the dialog class you can have the wizard do that for you or you can go to the "MFCTestDlg.h" file and add them yourself. The "main()" equivalent is found in "MFCTest.cpp" - the dialog creation is found in line 57 and it's invocation (open) is done with "int nResponse = dlg.DoModal();". Note that this call only returns when the dialog is closed.
I hope this quick start guide helps you. This is how I started it and works for me. The rest of the variations (like diferent controls and such) you can learn as you go along. MFC functions will always respond to the F1 key for help.
Rogério
|
|
|
|
|
I would like to create a base class that forms a template for inherited classes, in order to use similar names for different implementations.
How is this possible in C++?
Jon
|
|
|
|
|
Do you mean create an abstract base template class?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|