The dialog shows ok and wait for operate,but when calling drawnow in custom control's key handle fuction,there is nothing updated!The draw fuction in custom control is called correctly,but the show is just the same ,nothing updated?
TKeyResponse CCustomDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if (HandleKeyEvents(aKeyEvent, aType))
return EKeyWasConsumed;
else if(iFocusedControl)
return iFocusedControl->OfferKeyEventL(aKeyEvent, aType);
else
return EKeyWasNotConsumed;
}
TBool CSlider::HandleKeyEvents(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if ((aType == EEventKey) && IsFocused())
{
switch(aKeyEvent.iCode)
{
case EKeyRightArrow:
if(iVal<maxVal )
{
iVal+=iStep;
TBuf<9> temp;
temp.Num(iVal);
valueLabel->SetTextL(temp);
DrawNow();
//ActivateL();
}
else
iVal = maxVal;
return ETrue;
break;
case EKeyLeftArrow:
if(iVal>minVal)
{
iVal-=iStep;
TBuf<9> temp;
temp.Num(iVal);
valueLabel->SetTextL(temp);
DrawNow();
// ActivateL();
// Window().Invalidate();
}
else
iVal = minVal;
return ETrue;
break;
default:
;
}
}
return EFalse;
}
void CSlider:raw(const TRect& aRect) const
{
if (!Rect().IsEmpty())
{
CWindowGc& gc=SystemGc();
gc.SetClippingRect(aRect);
gc.Reset();
TSize sz(line->SizeInPixels());
gc.BitBltMasked(bitRect.iTl+TPoint(0,
(bitRect.Height()-sz.iHeight)/2),
line,
TRect(TPoint(0,0),TSize(bitRect.Width(),bitRect.Height()) ),
line_m,
ETrue);
//draw drag icon
TSize sz2(drag->SizeInPixels());
TInt ix = (iVal-1)*(bitRect.Width()-sz2.iWidth) /(maxVal-1) ;//+ (bitRect.Width()-sz.iWidth)/2;
TInt iy = (sz.iHeight - sz2.iHeight)/2 + (bitRect.Height()-sz.iHeight)/2;
gc.BitBltMasked(bitRect.iTl+TPoint(ix,iy),
drag,
TRect(sz2),
drag_m,
ETrue);
}
}

raw(const TRect& aRect) const
Reply With Quote

