15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CheckListBox and [X] Use tabstops

Klaus Kurzawa -- klausk@saruman.cadpoint.se
Wednesday, April 10, 1996


Hi,

Data: 
MSVC 4.0p2 & NT 3.51 (Intel) & !Newshell


CheckListBox:
Selection: None
Ownerdraw: Fixed
[X] Has Strings
[X] Use tabstops


PROBLEM: 
When using tabs in the string of a checklistbox the character is printed instead
of expanded to spaces.


MY SOLUTION::
Override the checklistbox and the drawitem-function. 
Change the part at the end for ExtTextOut to:

if (GetStyle() & LBS_USETABSTOPS)
{
        pDC->TabbedTextOut(lpDrawItemStruct->rcItem.left,                       
                           lpDrawItemStruct->rcItem.top+
                                max(0,(cyItem-m_cyText)/2),
                           strText, strText.GetLength(), 
                           0, NULL, 0);
}
else
{
        pDC->ExtTextOut(lpDrawItemStruct->rcItem.left,                          
                        lpDrawItemStruct->rcItem.top + 
                                max(0, (cyItem - m_cyText) / 2),
                        ETO_OPAQUE,                                             
                        &(lpDrawItemStruct->rcItem), 
                        strText, strText.GetLength(), NULL);
}

This works for me but I don't know if You would have done it another way?
Please help me.


QUESTION:
Is there a public fix for using tabstops in checklistbox or should I change 
anything to make my fix more general?


/Klaus Kurzawa
klausk@cadpoint.se





Mario Contestabile -- Mario_Contestabile.UOS__MTL@UOSMTL2.universal.com
Tuesday, April 16, 1996

>QUESTION:
>Is there a public fix for using tabstops in checklistbox or should I change 
>anything to make my fix more general?
>/Klaus Kurzawa
>klausk@cadpoint.se

You may wish to check the april 96 MSDN, I remember seeing a tech note on a 
CCheckListBox Bug.

mcontest@universal.com





| Вернуться в корень Архива |