|
Derek Waters wrote:
int viInsertedAt = InsertItem(&tvi);if (viInsertedAt != -1){ m_ctrlList.SetItemText(viInsertedAt, 1, _T("Dir")); m_ctrlList.SetItemText(viInsertedAt, 2, _T("XXX")); m_ctrlList.SetItemText(viInsertedAt, 3, _T("FALSE"));}
I tried this and put a message box if it made it there and what number it was on and it went 0 through nine but nothing. I am totally lost.
-Matt Newman
-Matt Newman
|
|
|
|
|
What did SetItemText return?
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
False
-Matt Newman
-Matt Newman
|
|
|
|
|
Right, I'm stumped. Do you want to send me your code?
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I will email you the whole project tommorrow. It about 160 KB compressed. I need to sleep now.
-Matt Newman
-Matt Newman
|
|
|
|
|
Stupid me. I was calling the function to fill the control before I declared the columns. Now it works. Thanks for trying to help.
-Matt Newman
-Matt Newman
|
|
|
|
|
(Using WTL)
How can I put multiple template params (>1) in a macro definition?
I've been using CHAIN_MSG_MAP() to pass messages to templatized base classes with ease for quite a while now. But today I decided to get a little fancy & in turn break things horribly.
Take the following as an example, the first CHAIN_MSG_MAP works, but why does the second cause a host of compiler errors?
If I use a typedef of the multiple param base class, all will work - but why? There has got to be a method that feels less like a hack.
////////////
template <class T>
class CWorks
{
public:
BEGIN_MSG_MAP(CWorks)
END_MSG_MAP()
};
template <class T, BOOL bSomething>
class CBroken
{
public:
BEGIN_MSG_MAP(CBroken)
END_MSG_MAP()
};
class CMyWindow : public CWindowImpl<CMyWindow>,
public CWorks<CMyWindow>
public CBroken<CMyWindow, TRUE>
{
public:
BEGIN_MSG_MAP(CMyWindow)
CHAIN_MSG_MAP( CWorks<CMyWindow> )
CHAIN_MSG_MAP( CBroken<CMyWindow,TRUE> )
END_MSG_MAP()
};
|
|
|
|
|
CHAIN_MSG_MAP( CBroken<CMyWindow,TRUE> )
Use a typedef to get rid of the comma (which is the source of the problem).
typedef CBroken<CMyWindow,TRUE> theBrokenClass;
CHAIN_MSG_MAP( theBrokenClass )
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
Hi all!
I made a tree in my dialog. I successfully inserted a few nodes to the tree. The problems arise when I try to access the node that is being selected. I always get a NULL pointer when I try to get the handle to the selected node. Can any one tell me what I miss?
When I insert the nodes, I ignore the *hItem* entry. Is it the cause, if so , how do you fix this?
Here is what I did. I used 2 ways and they both give me a null pointer return:
void CMyDlg::OnClickTreeview(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hSelectedNode =
pNMTreeView->itemNew.hItem;
//get the handle to the selected node
if (!hSelectedNode)
AfxMessageBox("fail to get the handle");
else
AfxMessageBox("Get the handle OK");
}
//*****************************
another way is:
CTreeCtrl * pTree =
(CTreeCtrl*) GetDlgItem(IDC_TREE);
HTREEITEM hSelectedNode =
pTree->GetSelectedItem();
//*******************************
Thank You
Vu
vucsuf
|
|
|
|
|
Here's some bits for you.
Changed selection
void CExIncView::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
TVITEM ThisID;
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
//get itemID.
ThisID = pNMTreeView->itemNew;
//Some extra bits for you
GetTreePath();
SetFileList();
*pResult = 0;
}
Traverse tree creating a tree path string
void CExIncView::GetTreePath()
{
CString lString;
CString sTemp,sTemp2;
HTREEITEM lItem;
DWORD Code;
lItem = m_pDirTree.GetSelectedItem();
sTemp = m_pDirTree.GetItemText(lItem);
Code = m_pDirTree.GetItemData(lItem);
lString = sTemp;
while( (lItem=m_pDirTree.GetParentItem(lItem)) != NULL )
{
sTemp = m_pDirTree.GetItemText(lItem);
Code = m_pDirTree.GetItemData(lItem);
//can make use of the ItemData to trigger different
// code branches and pass some bit data
sTemp2 = lString;
lString.Format("%s\\%s",sTemp, sTemp2);
}
m_Filename = lString;
// UpdateData(FALSE);
}
Find a string item in my tree. Actually I nearly always keep tree data in a CList or one of its type,
seaches in a control with a lot of data can be slow for everyday use. Plus, you can store TV_ITEM objects
in your List as items are added so that you can search and then select you tree item very quickly.
This first function just shows a way to traverse. It calls a 2nd which finds the item by name
Only put this as a quick way to change my Clist search to a tree search
const int MAX_ITTERATIONS = 100;
void CExIncView::FindInTree(CString &sText)
{
bool Done = FALSE;
int j,Pos;
char *lTreeNames[MAX_ITTERATIONS];
CString lString;
//split the directory name into individual strings
for(j=0;j
|
|
|
|
|
Hi There!
Thank you for your help. The problem I have is different. I have a tree structure in the background. I then use SetItemData() to hook each node to a node in my backGround tree. When a node of CTreeCtrl is clicked, I display the coresponding node data in my backGround Tree. In the OnClick() event, I need to get the handle to the node that is selected. The problem I am having is that getSelectedItem() returns NULL at the beginning. After a few clicks, it seems to give me correct handle. I don't know if the search process is too slow or because the SetItemData screw me up. Do you have any clue?
Thanks
Vu
vucsuf
|
|
|
|
|
I suspect that you are trying to GetSelectedItem() actually between the change, there's a point at which none is selected.
You wrote the function as getSelectedItem(), are you doing this in java? You, you trator you (only joking man).
Anyway, check there is a selection first then with maybe a hit test.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
I'm working on an app that will have a buttload of custom controls, using bitmaps, etc. I need to be able to change the appearance of the scrollbar to match. If I have to, I'll do my own scrollbar from the ground up, using bitamps, but that will be a lot of work.
So I'm looking intoi just changing te colors of the standard oolbar. I know this can be donw, I've seen it on some web sites - and I believe this is just IE using some varioation of the stardard scrollbar. But I can't see how it's done. The stuff in the FlatScrollbar APIs only allows me to change the background color of the scrollbar, and that really doesn't look very good.
Can anyone give me a clue?
Thanks -
|
|
|
|
|
i think you are not interested in my opinion towards colored scrollbars (HORRIBLE).. so i let it be..
paul di lascia wrote an article bout that in the november issue of the msdn mag.. maybe this helps you..
http://www.msdn.microsoft.com/msdnmag/issues/01/11/c/c0111.asp
hope this helps..
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
Actually, I am interested in your opinion, and I do agree with you: colored crollbars, as implemented on many Web pages, are ugly and worthless. (I even came across a page describing how to create scrollbars that flash in multiple colors.. my god, whatever happened to tasteful design?)
Anyway, what I want to do is include scrollbars inside a heavily bitmapped interface, and I'd like the colors to match the bitmap, rather than the Windows color scheme.. so I can plead an exception to the above.
In any case, it looks like this is not supported in Windiws; Paul's article esentially states that if you want to do anything worthwhile, I'd have to code the thing from scratch, which is what "im trying to avoid.
All the above notwithstanding.. thanks for the pointer.
|
|
|
|
|
i think if you want to have control about everything in your ui you should make sthing like a skinned ui (winamp, sonique) -> someone on this page wrote an article how to implement this.. how hard / easy this is? i have got no clue...
to your general question: i never missed the good ole windows scrollbars in sonique.. and i i never will.. i just don't like app's at all which look like normal windows gui - apps, but have got colored scrollbars and a colorful background.. (think one of the biggest problems of visual basic programmers.. an icon for every button.. but the rest is the same)
yaya.. just my 5 cent...
have a nice one
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
Hello everyone out in the C++ Forum...just a quick note to inform everyone of today's release of Ultimate Grid 5.0 for MFC...lots of great new features are included, so you might want to check it out.
Ultimate
Grid 5.0 for MFC
Thanks a lot
Ed Worsfold
Dundas Software
|
|
|
|
|
I'm already an expert on how to make it crash. That's not what I'm after. I want to be able to temporarily lock up the main thread from another thread. I tried EnableWindow(FALSE) but the script re-enables it. I also tried CFrameWnd::SuspendThread() but that didn't do anything.
Cathy
|
|
|
|
|
Can you give more details on what you're trying to achieve Cathy? I'm a little unclear what you mean by "but the script re-enables it".
Usually freezing the UI thread is a bad idea because then the UI won't paint etc. etc...
I'm presuming you're doing some non-reentrant activity in a worker thread, and you need to stop commands whilst it's busy.
However, if EnableWindow() isn't cutting the mustard for you and you just need to prevent menu/toolbar activity, selectively trapping CN_COMMAND messages in an OnCmdMsg() override in the mainframe might achieve what you need. Remember to let CN_UPDATE_COMMAND_UI calls through though or your toolbars etc. won't update properly.
Good luck
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++ 5.0/6.0
"I'm just another 'S' bend in the internet. A ton of stuff goes through my system, and some of the hairer, stickier and lumpier stuff sticks."
- Chris Maunder (I just couldn't let that one past )
|
|
|
|
|
Andy Metcalfe wrote:
Can you give more details on what you're trying to achieve Cathy? I'm a little unclear what you mean by "but the script re-enables it".
The other thread is trying to determine if they have a valid license. I don't want them to be able to use the program for a certian period during the validation. Our program is a COM server. If I disable the main window, the scripting engine reinables it.
Andy Metcalfe wrote:
However, if EnableWindow() isn't cutting the mustard for you and you just need to prevent menu/toolbar activity, selectively trapping CN_COMMAND messages in an OnCmdMsg() override in the mainframe might achieve what you need. Remember to let CN_UPDATE_COMMAND_UI calls through though or your toolbars etc. won't update properly.
Thank you. I will try that.
Cathy
|
|
|
|
|
Try using a mutex/WaitForSingleObject to pause your main thread. Then from the thread that verifies that they have a valid license, close the mutex, thus allowing your main thread to continue.
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Unless I'm missing something that will still prevent the UI from painting during the checking process.
Good idea in all other respects though!
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++ 5.0/6.0
"I'm just another 'S' bend in the internet. A ton of stuff goes through my system, and some of the hairer, stickier and lumpier stuff sticks."
- Chris Maunder (I just couldn't let that one past )
|
|
|
|
|
Good luck Cathy. OnCmdMsg() is a useful (and damn scary at times) thing to mess with.
If you get stuck, shout and I'll post some examples.
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++ 5.0/6.0
"I'm just another 'S' bend in the internet. A ton of stuff goes through my system, and some of the hairer, stickier and lumpier stuff sticks."
- Chris Maunder (I just couldn't let that one past )
|
|
|
|
|
hi
1) how can i get the names of the columns in a table without creating a CRecordset. I get the tables form the MSysObjects table. Maybe there is an other way to get the tables?????
I work with a Access databases, SQL and use the ODBC drivers.
2) is there a way to change the rights (read, write..) in C++ without using Access. Maybe through the ODBC driver????????????
please help!!!!!!!!!!!!!
Thx
|
|
|
|
|
hi,
anyone know how transfer datas from the Main Dialog to a TabPage?
|
|
|
|