|
Hi,
I'm not sure ... you've got a combobox only with drive letters and on treectrl full path, and when you select some path on tree, in combobox should appear full path ?
If yes:
- HTREEITEM GetSelectedItem() - you'll get selected item handle
- CString GetItemText( HTREEITEM hItem ) - you'll get item text
- HTREEITEM GetParentItem( HTREEITEM hItem ) - you'll get parents' item handle
- CString GetItemText( HTREEITEM hItem ) - you'll get item text
...
unless your parents' item handle will equal with root
- HTREEITEM GetRootItem( )
when you'll get all path, you can send all text to combobox
- int InsertString( int nIndex, LPCTSTR lpszString )
and select
- int SetCurSel( int nSelect );
-----------
Mila
|
|
|
|
|
Do you select an item on treectrl and you want to compare it with item on combobox
|
|
|
|
|
Combobox is not having the item which got selected in the treectrl .so my requiremant is that, as the treectrl item get selected or get changed the combobox should show the current path of the item(which got selected on the treectrl) in its editbox.Is it possible..?and How ?
God hepls those who hepls themselves ....
Thanks in advance
Saniaa
|
|
|
|
|
You select an item on treectrl and now you want to display this item on ComboBox(edit),Right?
|
|
|
|
|
Hi,
Can we send the pixel coordinates into MS Paint and display the pixel in MS Paint through VC++.
Kiruba
|
|
|
|
|
Hello
You can not modify the behavior of MS paint . Microsoft is the owner !!!!!!
If possible try to get the source code of MS paint
redindian
|
|
|
|
|
Link error:
Linking...
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class
std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(class
std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)"
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in rts_scene_area.obj
msvcprt.lib(MSVCP71.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class
I ignore msvcprt.lib,the error still exist.
Runtime libaray is Multi-threaded (/MT),Boost library is included to identify point.
-- modified at 0:50 Friday 3rd November, 2006
|
|
|
|
|
silly question, but mabey you only have it ignored for debug mode but not release mode. Are you ignoring it in release mode as well?
|
|
|
|
|
|
See here[^]
maybe it is some helpful for you
|
|
|
|
|
Hi,
I intend to integrate the functionality of two dlls into one by means of merging the code. I'm adopting the following steps.
1) Create a master framework for the merged entity say dll A.
2) Include all the files that are distinct for the two dlls(B & C) into the project created for dll A.
3) For all the files that are same in dll B and C, include a single file into the merged entity and into that file put all the functions that are distinct in the file under B and C.
I think this should suffice. Please correct if there is something to be done
The problem comes for functions that are same in the common file.
Say in dll B We have a function like
class B : function()
{
}
Say in dll C We have a function like
class C : function()
{
}
Here the two different functions need to be merged into a single function under a class name.
Now my question is how does the merged entity break into two workflows similar to the functional behavior in the previous separate dlls? What kind of conditional can be put for identifying the different behaviors?
Thanks
|
|
|
|
|
I would suggest using an argument within the definition of the merged function and simply use either a case handler or if statement to control which one is used.
If they perform different processing should they really be merged into a single function?
|
|
|
|
|
How can I make a WAN connection between remote computers behind NAT without using port forwarding.
|
|
|
|
|
|
I am beginer .I have drag an RichTextEdit control to Dialog but it isn't show for me when i debug.
Thank you for helping.
Enjoy for helping
|
|
|
|
|
Have you called AfxInitRichEdit() or AfxInitRichEdit2() somewhere in your code?
|
|
|
|
|
When you run your program you dont see anything if yes you need to call AfxInitRichEdit
|
|
|
|
|
How do you generate content of a child dialog during runtime? I want something like this http://www.codeproject.com/dialog/scrollablechilddialog.asp but all the controls inside the child window need to be dynamically created. For example, the user can specify a number X on the parent window, and then I would generate X number of edit boxes with corresponding buttons in the child window.
|
|
|
|
|
Controls are child windows so create the controls and position them on the dialog window.
Using MFC or not?
Mark
|
|
|
|
|
Yes, MFC.
Can you be more specific? Maybe a sample code how to generate controls and how to position them. Also I will need those controls to be able to display data from the parent window. How can I do that?
Thanks
|
|
|
|
|
Here's the basic idea...dialog should be modeless...
void CMyDialogClass::AddButtonAndEditControls()
{
CButton *pButton = new CButton();
pButton->Create(_T("Text"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP, CRect(10,10,100,24), this, IDC_BUTTON1);
CEdit* pEdit = new CEdit;
pEdit->Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER, CRect(120,10,100,24), this, IDC_EDIT1);
} You'll probably want to keep the created control pointers in a container of some kind
(array, list, whatever) and assign each control unique IDs as they're created. Also adjust the
CRect params to position them properly or use MoveWindow() (example pButton->MoveWindow(...)) to
reposition them after they're created.
Don't forget to delete them when the dialog closes or when you're going to re-populate the window
with a different set of controls.
acerunner316 wrote: Also I will need those controls to be able to display data from the parent window. How can I do that?
Maybe pass a pointer to the parent window to the dialog when it's created so it can call parent
window methods to get the data.
|
|
|
|
|
I understand than all controls must have a unique ID, but if I were to generate the controls dynamically, I want a code that will generate the ID dynamically as well. I don't want to repeat this code for IDC_BUTTON1 through IDC_BUTTON200. Is there a way generate the ID in a for loop or something?
Can you also elaborate on passing pointers from parent window to child window? I am currently trying to call a function of the child class from the parent class to have it update the edit boxes.
for example: CChildDlg::UpdateEditBoxes();
but i'm getting the error "illegal call of non-static member function".
I want to be able to control when the edit boxes are updated from the parent window. So would I have to pass a pointer everytime I update?
Thanks again.
|
|
|
|
|
acerunner316 wrote: Is there a way generate the ID
Generate the IDs any way you'd like to. To extend the last example, add a couple variables (to
track the IDs) to your dialog class, initializing them in the constructor or (OnInitDialog()):
class CChildDlg : public CDialog
{
...
protected:
UINT NextButtonId;
UINT NextEditId;
...
};
CChildDlg::CChildDlg()
{
...
NextButtonId = 100;
NextEditId = 500;
...
}
void CChildDlg::AddButtonAndEditControls()
{
CButton *pButton = new CButton();
pButton->Create(_T("Text"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP, CRect(10,10,100,24), this, NextButtonId++);
CEdit* pEdit = new CEdit;
pEdit->Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER, CRect(120,10,100,24), this, NextEditId++);
}
acerunner316 wrote: for example: CChildDlg::UpdateEditBoxes();
but i'm getting the error "illegal call of non-static member function".
You need to call the UpdateEditBoxes() on an object. Use the pointer obtained when you created
the child dialog:
pChildDlg = new CChildDlg(...);
pChildDlg->Create(...);
...
pChildDlg->UpdateEditBoxes();
|
|
|
|
|
Thanks that worked. So now I can access child functions from the parent?
How about vice versa? How can I access parent functions from the child?
Same for variables. For example, if I press a button in the child (ie CChildDlg::OnButtonPress() ), I want the parent to react to it.
Also, after having dynamically generated the buttons and edit boxes along wiht the ID, how do I now assign a member variable to it? Do I need some sort of dynamic code in the DoDataExchange function?
|
|
|
|
|
acerunner316 wrote: So now I can access child functions from the parent?
Yes, as long as you have a child object to use (pointer allocated with new in the example code).
As long as you keep that around as a member variable in the parent you can call any methods or use
any public variables in the child class.
acerunner316 wrote: How about vice versa? How can I access parent functions from the child?
Sure. You need to get a parent window pointer in the child somehow. You could use GetParent()
in the child class and cast the returned pointer to your parent class. You could also provide
a method in the child class that accepts a pointer to the parent window. Your CDialog and CWnd
derived classes are just classes. CDialog/CWnd wrap the windows API but beyond that you can
extend derived classes any way that suits your needs.
acerunner316 wrote: Same for variables. For example, if I press a button in the child (ie CChildDlg::OnButtonPress() ), I want the parent to react to it.
You could use the ON_COMMAND_RANGE macro in your message map for the range of possible button IDs.
Then in the command (range) message handler use the parent window (obtained like above) to
call a method on the parent to do something. Another way is to post a user msg (using
PostMessage() or SendMessage()) to the parent. If your dialog class always knows its parent
window class (in other words, it won't be used as a child of another class) then using a pointer
to that class type is easiest.
acerunner316 wrote: Also, after having dynamically generated the buttons and edit boxes along wiht the ID, how do I now assign a member variable to it? Do I need some sort of dynamic code in the DoDataExchange function?
If you want to use DDE then yes you'll need to loop through your controls and call DDX_Control()
on each of them. You can always manipulate the controls directly as well. See the CButton and
CEdit class docs for all the member functions you can use.
|
|
|
|