 |
|
 |
good job
|
|
|
|
 |
|
 |
I desparately needed CStatic with wordwrap option! And you have it!
|
|
|
|
 |
|
 |
When you use SetDlgItemText or SetDlgItemInt function you can't set correctly.
When I fixed OnSetText function this->GetWindowText(m_strText); to this->SetWindowText((LPCTSTR)lParam);
it's flicker.
Hongjun Ge
|
|
|
|
 |
|
 |
Can I get this control for wxWidgets
Kindly help!!
|
|
|
|
 |
|
 |
In the methode 'DrawBitmap' you should put
pDCMem->SetStretchBltMode(COLORONCOLOR);
before
pDCMem->StretchBlt(rect.left, rect.top, rect.Width(), rect.Height(), &dcMem, 0, 0, m_bmInfo.bmWidth-1, m_bmInfo.bmHeight-1, SRCCOPY);
because the colors of pictures greather than 320x240 (i'm not sure the right size)
getting crazy without that.
Sorry for my bad english
-- modified at 8:54 Wednesday 11th January, 2006
|
|
|
|
 |
|
 |
Hi
I have found a small bug in the PreSubclassWindow()method which caused a BOOL CGdiObject::Attach(HGDIOBJ hObject)
ASSERTION, I repaired it by adding the lines below..
if (m_font.GetSafeHandle())
m_font.DeleteObject();
// create the font for this control
but other than that nice work.
Mike
-- modified at 9:05 Sunday 6th November, 2005
|
|
|
|
 |
|
 |
Ok thanks mike,
I will fix it in my next release.
This control was abandoned but I may have to work with it very soon so I will fix remaining bugs and
I will add windows CE compatibility and support more image format(cxImage).
Regards
|
|
|
|
 |
|
 |
Hi,
Tanks for your effort and the new release. I just download new version and now I have a problem with text position. Function GetStyle don't give the correct initial control text position (when created the static control). Now the default text position is centered DT_CENTER. Did you have found it?
jpbouley
|
|
|
|
 |
|
 |
Yes you are right!
Now the control is owner drawn GetStyle() seems not to work anymore.
Needs to find a fix.
|
|
|
|
 |
|
 |
Hi,
I have work a little to fix that and the main problem is on the GetStyle() function. According Microsoft documentation style retuned is not from the control but on the dialog. Because have use the CxStatic class for presonnal application I have find a quick fix by passing an additionnal psoition parameter. It is working but it's not "beautiful" and text position is not completely controlled.
Best regards
|
|
|
|
 |
|
 |
Ok I found the solution
Add a DWORD member variable m_dwFlags
and modify as described below :
void CxStatic::PreSubclassWindow()
{
//TRACE(_T("in CxStatic::PreSubclassWindow\n"));
m_dwFlags = GetStyle();
ModifyStyle(SS_TYPEMASK, SS_OWNERDRAW);
...
}
void CxStatic::DrawText(CDC* pDCMem, CRect* pRect, CString csText)
{
DWORD dwStyle = m_dwFlags;
DWORD dwFlags = 0;
...
}
and it should work.
|
|
|
|
 |
|
 |
Hello,
Add to TODO list.
a) Unicode (TCHAR / char)
b) AppendText() with CString (has no limit)
strAdd.FormatV(lpFormat, varg);
Jimmy
PS: great tool
|
|
|
|
 |
|
 |
Hi,
well done, however:
- No support for multi-line input? I tried and the text is not correctly drawn, it overlaps with the other lines (a screenshot would be more appropriate than words). Did you try?
- perhaps it would be more elegant (and efficient) to draw text directly line by line rather than storing it, then drawing it.
Besides, I HATE CStringArray::Add() At least, use SetSize(3, 3) and then SetAtGrow(i++, ....), because user is likely to have more than a single line drawn and it would prevent reallocating the array too often (and each time the control is drawn .
Pixi
|
|
|
|
 |
|
 |
Hi,
I am currently working to fix some bugs.
In particular UpdateData doesn't work.
I will release a new version very soon and I will take in account your comments.
For the multi-line input d you have any sample code you can send so I test because I don't understand exactly the problem.
Thanks a lot!
|
|
|
|
 |
|
 |
Actually, I just changed the input edit control in the demo project to a multiline one in the resource editor. And, if you type:
sdklfjsldkjflj
ldsflkdslmkf
fdlmkslfkmdlkfms
dlkmlkkkkkk
for example, then the 3rd line is drawn over another line.
wrapping + multiline input support would make this control really nice.
Thanks.
Pixi
|
|
|
|
 |
|
 |
I will try but don't expect to be done too quickly because I am a bit busy right now
|
|
|
|
 |
|
 |
quick hack (a bit ugly but it works).
void CxStatic::DrawText(CDC* pDCMem, CRect* pRect, CString csText)
{
DWORD dwStyle = GetStyle();
DWORD dwFlags = 0;
// Map "Static Styles" to "Text Styles" - WARNING MACROS
#define MAP_STYLE(src, dest) if(dwStyle & (src)) dwFlags |= (dest)
#define NMAP_STYLE(src, dest) if(!(dwStyle & (src))) dwFlags |= (dest)
MAP_STYLE( SS_RIGHT, DT_RIGHT );
MAP_STYLE( SS_CENTER, DT_CENTER );
MAP_STYLE( SS_LEFT, DT_LEFT );
//MAP_STYLE( SS_CENTERIMAGE, DT_VCENTER | DT_SINGLELINE );
MAP_STYLE( SS_NOPREFIX, DT_NOPREFIX );
MAP_STYLE( SS_WORDELLIPSIS, DT_WORD_ELLIPSIS );
MAP_STYLE( SS_ENDELLIPSIS, DT_END_ELLIPSIS );
MAP_STYLE( SS_PATHELLIPSIS, DT_PATH_ELLIPSIS );
// TAb expansion
if (csText.Find( _T('\t') ) != -1)
dwFlags |= DT_EXPANDTABS;
// TEXT WRAPPING - Inspired by Chen-Cha Hsu and improved
CRect newRC;
TEXTMETRIC tag;
CSize sz;
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), csText,csText.GetLength(), &sz);
CStringArray asText;
int nLine = 0;
CString s2;
int nIdx, nX = 0;
int nId = 0;
char nCR = 0;
// Autowrapping mode enabled
if ( m_bAutoWrapping ){
for (int i = 1; i <= csText.GetLength(); i++){
s2 = csText.Left(i);
//CARRIAGE RETURN is not recognised with SS_CENTERIMAGE - manual handling
if (csText.GetAt(i-1) == '\r' || csText.GetAt(i-1) == '\n'){
if (nCR == 0){
nCR = csText.GetAt(i-1);
}
else if (nCR != csText.GetAt(i-1)){ // "\r\n" or "\n\r"
s2 = csText.Left(i-2);
asText.Add(s2);
//asText.Add("");
csText = csText.Mid(i);
i = nCR = 0;
}
}
::GetTextExtentPoint32(pDCMem->GetSafeHdc(), s2, s2.GetLength(), &sz);
if ( sz.cx > pRect->Width() ){// We found how many letters fits
s2 = csText.Left(i-1);
if ( IsASingleWord(s2) ){
asText.Add(s2);
csText = csText.Mid(i-1);
i = 0;
}
else{ // Do not break a word
nId = s2.ReverseFind(' ');
s2 = s2.Left(nId);
asText.Add(s2);
csText = csText.Mid(nId + 1);
i = 0;
}
}
}
if ( ! csText.IsEmpty() )
asText.Add(csText);
}
else{// No Need For Wrapping
asText.SetAtGrow(0, csText);
}
pDCMem->GetTextMetrics(&tag);
newRC = *pRect;
nLine = asText.GetSize();
LONG nDiff = pRect->bottom - pRect->top - tag.tmHeight * nLine;
if (dwStyle & SS_CENTERIMAGE)
pRect->top = nDiff/2;
TRACE( "The value of nDiff is %d\n", nDiff );
if (m_bAutoAdjustFont){
if (nDiff < 0){
m_nFontSizeVar--;
SetFont( m_lf.lfFaceName, m_nFontSizeVar, m_lf.lfWeight );
}
//pDCMem->SelectObject( m_pFont ); TODO CHECK WITH AUTOADJUST
//RedrawWindow();
}
for (int j = 0; j < asText.GetSize(); j++){
newRC.top = pRect->top + tag.tmHeight * j;
pDCMem->DrawText(asText[j], &newRC,dwFlags);
if (m_bFont3d){
if (m_3dType == Raised)
newRC.OffsetRect(-1,-1);
else
newRC.OffsetRect(1,1);
pDCMem->DrawText(asText[j], &newRC,dwFlags);
}
}
}
|
|
|
|
 |
|
 |
Yeah it works!
Pixi
|
|
|
|
 |
|
 |
Thank you for this nice control. But I noticed in the TODO list there is GDI+. Please don't. In my opinion it is not a good idea for a simple static control to be dependent on GDI+. Just a suggestion. Otherwise, nice work.
|
|
|
|
 |
|
 |
About GDI+ my idea is to learn because in a near future I will have to work with it. But I won't modify the existing control, I will start a new project.
|
|
|
|
 |
|
 |
Hi,
there is a memory leak you your tracker handling.
press rbutton, move, then press rbutton again.
now you have a memory leak.
Jimmy
|
|
|
|
 |
|
 |
I will have a look as soon as possible.
|
|
|
|
 |
|
 |
I have been faced the fact that Memory leak is to Invalide();
during 6 hour no problem, but as to 7 hour memory full then Stop process. ㅠ ㅠ
i using too methods to solve that.
now, how i doing?
|
|
|
|
 |
|
 |
Hi All!
Does anybody have a solution for this problem?
I'm running from CLabel class because a similar problem.
cheers!
|
|
|
|
 |