Symbianos Series 60 Learning Note 2: Listbox Controls

zhaozj2021-02-16  93

Finally, the ListBox control of Series? 60 has a relatively clear understanding. I really look at this code. I really have a little catching the bull. I declare a CEIKCOLUMNLISTBOX * _Listbox in its constructl function in the container class of the ListBox control. CEikColumnListBox a configuration example of _listBox = new (ELeave) CAknSingleStyleListBox; _listBox-> ConstructL (this); _ listBox-> SetContainerWindowL (* this); _ listBox-> CreateScrollBarFrameL (ETrue); _ listBox-> ScrollBarFrame () -> SetScrollBarVisibilityL (CEikScrollBarFrame :: EON, CEIKSCROLLBARFRAME :: EAUTO); Because of the need to deal with the keypress event _Listbox-> setListBoxobServer (this); so the container class here must expand the public? MEIKLISTBOXOBSERVER header must contain eiklboXOBServer ? virtual function void CTestListContainer :: HandleListBoxEventL (CEikListBox * aListBox, TListBoxEvent aEventType) here KeyPress event processing needs aEventType == EEventEnterKeyPressed need to know if one is selected ItemTInt number (_listBox-> CurrentItemIndex ()); number is zero process until ListBox total Item minus an integer of moving up and down selection is a function TKeyResponse CTestListContainer :: OfferKeyEventL (const TKeyEvent & aKeyEvent, TEventCode aType) {if (aType = EEventKey!) {return EKeyWasNotConsumed;} f (_listBox) { Return_Listbox-> OfferKeyEventl (akeyevent, atype);} else {return Ekeywasnotconsumed;}} This function is primarily to process buttons, it is not specifically for ListBox, of course, here is the handling listbox up and down mobile buttons.

Listbox Item can generate dynamic adding dynamic adding and resource files? TBUF <32> Item; _LIT (Kitemname1, "234234234234"); // There is a style format item.format (_L ("% s"), & kitemname1) ListBoxItems-> appendl (item); _ LIT (Kitemname2, "RTTETETETET"); item.format (_L ("% s"), ?? & kitemname2); listboxItems-> appendl (item); _ lit (kitemname3, "adsfasfasfasfasfasfasdf" ); item.format (_L ("% s"), & kitemname3); listboxItems-> appendl (item); _Listbox-> handleitemadditionL (); _ listbox-> setCurrentItemIndexandDraw (listboxItems-> count () - 1); _ listbox-> Activatel (); Here is some of the initial understanding of the Listbox box. The first feel feels in Symbian because it is not visualization programming, so adding controls are more troublesome but Symbian's program structure is indeed very reasonable. It is also a icon.

Very simple New has a list of CaknsingLargeStyleListBoxs_Listbox = new (eleave) CaknsingLaRGestyleListbox; establish an array to save ICO information

CakniconArray * iconList = New (eleive) Cakniconarray (10);

Cleanupstack :: Pushl (iconList);

Add icon information to an array

IconList-> appendl (Ieikonenv-> Createiconl (KiconsFileName, EmbmtestlisTliStgo2, EmbmtestListGolgo2m);

Don't forget Cleanupstack :: POP ();

EMBMTESTLISTGOLGO2 and EMBMTESTLISTGOLGO2M are defined in .mbg

Put some bitmaps in a. MBM file, there is an ID of each bitmap resource

Of course, put the bitmap. MBM must be defined in the .mmp file

Such as

Start Bitmap Testlist.mbm

TargetPath SystemApps Estlist

HEADER

SourcePath ?? ../bmp

Source ?? c12 golgo2.bmp

Source? C12? Golgo2m.bmp

End

Add icons to Listbox

I am using it.

_Listbox-> itemdrawer () -> columndata () -> seticonarray (iconlist);

Alternative to CeikFormattedCellListbox extension ListBox

_Listbox-> itemdrawer () -> formattedcelldata () -> seticonarray ();

_Listbox-> itemdrawer () -> formattedcellData () -> setSubCellalignmentl (2, CGRAPHICSCONText :: ELEFT);

Of course, you should pay attention to the format when you add Item.

TBUF <32> Item;

_LIT (Kitemname1, "234234234234);

Item.Format (_L ("% D% s"), 0, & kitemname1);

ListboxItems-> appendl (item);

There are many format Listbox in Symbianos (Series 60 Platform), more detailed information can be obtained at http://perso.wanadoo.fr/klisa/3650/listbox/page01.html.

转载请注明原文地址:https://www.9cbs.com/read-11939.html

New Post(0)