
Clasa CComboBox Combo box-ul (CB) contine un control de editare single linie si un control list box. Combo box- urile pot avea stilurile simple ( CBS_SIMPLE ), drop-down ( CBS_DROPDOWN ) si drop-down list ( CBS_DROPDOWNLIST ). Un CB simplu afiseaza in permanenta lista articolelor pe care le contine. Cind articolul este selectat din lista acesta este copiat in CE. Utilizatorul poate tasta text direct in CE al CB. Daca textul din CE al CB se potriveste cu un articol din list box (LB), articolul este afisat automat pe video invers iar asupra LB se fac operatii de navigare verticala (scroll). CE al CB este de fapt un obiect CEdit. Un CB drop-down, difera de un CB simplu prin aceea ca LB asociat este afisat numai la cerere. Un CB drop-down list lucreaza la fel ca un CB drop-down cu diferenta ca nu se permite editarea in CE al CB. Stilul CB se completeaza ca un parametru in functia Create sau CreateEx . Alte stiluri care pot fi date controleaza aspectul CB si comportarea acestuia (CBS_AUTOHSCROLL, WS_VSCROLL, WS_BORDER, etc.). Daca m_wndComboBox este un obiect CComboBox , instructiunea m_wndComboBox.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ WS_VSCROLL ¦ CBS_DROPDOWNLIST ¦ CBS_SORT, rect, this, IDC_COMBOBOX); creaza un CB drop-down list, a carei lista verticala contine bara de derulare (navigare, scroll) care va deveni vizibila cind numarul articolelor care pot fi afisate depaseste zona de afisare si de asemenea articolele din lista vor fi sortate. Dreptunghiul controlului trebuie pe care il specificam in CComboBox::Create trebuie sa fie destul de mare pentru a cuprinde si CE asociat si articolele din lista. Stilurile pentru Combo Box Style Description CBS_AUTOHSCROLL Enables horizontal scrolling in the edit control portion of a combo box. CBS_DISABLENOSCROLL Disables the combo box list box's scroll bar when it isn't needed. Without this style, an unneeded scroll bar is hidden rather than disabled. CBS_DROPDOWN Creates a drop-down combo box. CBS_DROPDOWNLIST Creates a drop-down list combo box. CBS_HASSTRINGS Creates a combo box that "remembers" the strings added to it. Conventional combo boxes have this style by default; owner-draw combo boxes don't. CBS_LOWERCASE Forces all text in the combo box to lowercase. CBS_NOINTEGRALHEIGHT Prevents the combo box's list box height from having to be an exact multiple of the item height. CBS_OEMCONVERT A combo box whose edit control performs an ANSI- to-OEM-to-ANSI conversion on all characters so that the application won't get unexpected results if it performs an ANSI-to-OEM conversion of its own. Obsolete. CBS_OWNERDRAWFIXED Creates an owner-draw combo box whose items are all the same height. CBS_OWNERDRAWVARIABLE Creates an owner-draw combo box whose items can vary in height. CBS_SIMPLE Creates a simple combo box. CBS_SORT Automatically sorts items as they are added. CBS_UPPERCASE Forces all text in the combo box to uppercase. Functiile membre din CComboBox sunt asemanatoare cu cele din CEdit si CListBox . Constructie CComboBox Constructs a CComboBox object. Initializare Creates the combo box and attaches it to the CComboBox Create object. Preallocates blocks of memory for items and strings in the InitStorage list-box portion of the combo box. Operatii Generale Retrieves the number of items in the list box of a combo GetCount box. Retrieves the index of the currently selected item, if any, in GetCurSel the list box of a combo box. SetCurSel Selects a string in the list box of a combo box. Gets the starting and ending character positions of the GetEditSel current selection in the edit control of a combo box. SetEditSel Selects characters in the edit control of a combo box. Sets the 32-bit value associated with the specified item in a SetItemData combo box. Sets the 32-bit value associated with the specified item in a SetItemDataPtr combo box to the specified pointer ( void* ). Retrieves the application-supplied 32-bit value associated GetItemData with the specified combo-box item. Retrieves the application-supplied 32-bit value associated GetItemDataPtr with the specified combo-box item as a pointer ( void* ). Returns the index of the first visible item in the list-box GetTopIndex portion of the combo box. Tells the list-box portion of the combo box to display the SetTopIndex item with the specified index at the top. Sets the width in pixels that the list-box portion of the SetHorizontalExtent combo box can be scrolled horizontally. Returns the width in pixels that the list-box portion of the GetHorizontalExtent combo box can be scrolled horizontally. SetDroppedWidth Sets the minimum allowable width for the drop-down list- box portion of a combo box. Retrieves the minimum allowable width for the drop-down GetDroppedWidth list-box portion of a combo box. Deletes (clears) the current selection (if any) in the edit Clear control. Copies the current selection (if any) onto the Clipboard in Copy CF_TEXT format. Deletes (cuts) the current selection, if any, in the edit Cut control and copies the deleted text onto the Clipboard in CF_TEXT format. Inserts the data from the Clipboard into the edit control at Paste the current cursor position. Data is inserted only if the Clipboard contains data in CF_TEXT format. Limits the length of the text that the user can enter into the LimitText edit control of a combo box. Sets the height of list items in a combo box or the height of SetItemHeight the edit-control (or static-text) portion of a combo box. GetItemHeight Retrieves the height of list items in a combo box. GetLBText Gets a string from the list box of a combo box. GetLBTextLen Gets the length of a string in the list box of a combo box. Shows or hides the list box of a combo box that has the ShowDropDown CBS_DROPDOWN or CBS_DROPDOWNLIST style. Retrieves the screen coordinates of the visible (dropped- GetDroppedControlRect down) list box of a drop-down combo box. Determines whether the list box of a drop-down combo box GetDroppedState is visible (dropped down). Selects either the default user interface or the extended user SetExtendedUI interface for a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style. Determines whether a combo box has the default user GetExtendedUI interface or the extended user interface. GetLocale Retrieves the locale identifier for a combo box. SetLocale Sets the locale identifier for a combo box. Operatii asupra continutului unui combo box Adds a string to the end of the list in the list box of a AddString combo box or at the sorted position for list boxes with the CBS_SORT style. DeleteString Deletes a string from the list box of a combo box. InsertString Inserts a string into the list box of a combo box. Removes all items from the list box and edit control of a ResetContent combo box. Dir Adds a list of filenames to the list box of a combo box. Finds the first string that contains the specified prefix in the FindString list box of a combo box. Finds the first list-box string (in a combo box) that matches FindStringExact the specified string. Searches for a string in the list box of a combo box and, if SelectString the string is found, selects the string in the list box and copies the string to the edit control. Notificari Combo Box Combo box-urile trimit notificari parintilor lor in acelasi mod cum o face un control de editare sau un list box. Notificari Combo Box Notification Message-Macro Map Sim Drop- Drop-Down ple Down List CBN_DROPDOWN ON_CBN_DROPDOWN √ √ Sent when the drop-down list is displayed. CBN_CLOSEUP ON_CBN_CLOSEUP √ √ Sent when the drop-down list is closed. CBN_DBLCLK ON_CBN_DBLCLK √ Sent when an item is double- clicked. CBN_SELCHANGE ON_CBN_SELCHANGE √ √ √ Sent when the selection changes. CBN_SELENDOK ON_CBN_SELENDOK √ √ √ Sent when a selection is made. CBN_SELENDCANCEL ON_CBN_SELENDCANCEL √ √ Sent when a selection is canceled. CBN_EDITUPDATE N_CBN_EDITUPDATE √ √ Sent when the text in the edit control is about to change. CBN_EDITCHANGE ON_CBN_EDITCHANGE √ √ Sent when the text in the edit control has changed. CBN_KILLFOCUS ON_CBN_KILLFOCUS √ √ √ Sent when the combo box loses the input focus. CBN_SETFOCUS ON_CBN_SETFOCUS √ √ √ Sent when the combo box receives the input focus. CBN_ERRSPACE ON_CBN_ERRSPACE √ √ √ Sent when an operation fails because of insufficient memory. Din acest tabel observam ca nu toate notificarile se aplica tuturor tipurilor CB. Clasa CScrollBar Clasa CScrollBar din MFC incapsuleaza controalele scroll bar create din "SCROLLBAR" WNDCLASS. Controalele scroll bar sunt identice in mare parte cu barele de scroll ale unei ferestre. Controalele scroll bar pot fi plasate oriunde in cadrul unei ferestre si se poate seta latimea si inaltimea acestora. Aceste controale se creaza cu functia CScrollBar::Create . Stilurile SBS_VERT si SBS_HORZ definesc un control scroll bar vertical, respectiv orizontal. Daca m_wndVScrollBar si m_wndHScrollBar sunt obiecte CScrollBar , atunci instructiunile m_wndVScrollBar.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ SBS_VERT, rectVert, this, IDC_VSCROLLBAR); m_wndHScrollBar.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ SBS_HORZ, rectHorz, this, IDC_HSCROLLBAR); creaza doua controale scroll bar, unul vertical si unul orizontal. Determinarea latimii si inaltimii standard a acestor controale se face cu functia API ::GetSystemMetrics . In exemplul urmator, variabilele nWidth si nHight vor contine latimea si inaltimea standard a unui asemenea control: int nWidth = ::GetSystemMetrics (SM_CXVSCROLL); int nHeight = ::GetSystemMetrics (SM_CYHSCROLL); O alta metoda pentru a crea scroll bar cu inaltime si latime standard
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages13 Page
-
File Size-