×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    59

    Switching off the listbox selection highlight

    I'd like to remove the selection highlight for a listbox when the control loses focus, and switch it back on when focus returns. I've tried lots of different ways with little success. The following code works for switching the selection off, but doesn't work for switching it back on.

    The problem seems to be that something resets EDisableHighlight after I've unset it.

    void CContainer::FocusChanged(TDrawNow aDrawNow)
    {
    CCoeControl::FocusChanged(aDrawNow);

    TInt flags(iListBox->ItemDrawer()->Flags());
    if(IsFocused())
    {
    TInt mask(-1);
    mask ^= CListItemDrawer::EDisableHighlight;
    flags &= mask;
    }
    else
    {
    iListBox->SetFocus(EFalse);
    flags |= CListItemDrawer::EDisableHighlight;
    }
    iListBox->ItemDrawer()->SetFlags(flags);
    iListBox->DrawNow();
    }

    Does anyone have any suggestions?

    Thanks, Mark.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    21

    Re: Switching off the listbox selection highlight

    Try This code it will Works for both Cases
    void Container::FocusChanged(CAknColumnListBox* aListBox)
    {
    if(aListBox){
    TInt flags(aListBox->ItemDrawer()->Flags());
    flags |= CListItemDrawer::EDisableHighlight;
    if(aListBox->IsFocused()){
    aListBox->ItemDrawer()->ClearFlags(flags);
    }
    else{
    aListBox->ItemDrawer()->SetFlags(flags);
    }
    aListBox->DrawNow();
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×