На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
! Правила раздела Visual C++ / MFC / WTL (далее Раздела)
1) На Раздел распространяются все Правила Форума.
2) Перед тем, как создать новый топик, убедитесь, что Вы читали Правила создания тем в Разделе.
3) Вопросы, не связанные с программированием (настройки MS Visual Studio, книги, библиотеки и т.д.),
обсуждаются в разделе C/C++: Прочее
4) Вопросы разработки .NET (Windows Form, C++/CLI и т.п.) приложений на Visual C++/C# обсуждаются в разделе .NET.
5) Нарушение Правил может повлечь наказание со стороны модераторов.

Полезные ссылки:
user posted image FAQ Раздела user posted image Обновления для FAQ Раздела user posted image Поиск по Разделу user posted image MSDN Library Online
Модераторы: ElcnU
  
> всплывающая панель к combobox
    ???Подскажите, pls
    Нужна всплывающая панель к combobox
    как в Internet Explorer (в адресной панели, когда вводишь чего-нибудь всплывает listview с вариантами)
    Интересно, как они сделали энтот ма-а-аленький квадратик, который позволяет изменять размер панели ??? И как они загнали скроллер сверху этого квадратика  :o
      IMHO, они просто ставят/убирают нужные/ненужные строчки, а потом показывают (разворачивают) комбо. Я сам так не делал и это только мое имхо!
        Неверно. Там самопальное окно класса Auto-Suggest Dropdown
          Цитата Codemaster, 26.02.02, 13:08:51
          Неверно. Там самопальное окно класса Auto-Suggest Dropdown

          2Codemaster: Вы совершенно правы. Я тоже это видел в окне Spy++
          Меня же интересует слегка другой вопрос, а именно:  8) как они сделали энтот ма-а-аленький квадратик, который позволяет изменять размер панели  И как они загнали ScrollBar выше этого самого квадратика  ???    
            Рискну предположить, что скроллбар там всё же дочернее окно, создаваемое при необходимости.

            А вообще - см. http://www.codeproject.com/useritems/autocomp.asp
            Сообщение отредактировано: Codemaster -
              Цитата

              Using Autocomplete

              --------------------------------------------------------------------------------

              The IAutoComplete interface is exposed by the autocomplete object (CLSID_AutoComplete). It allows applications to initialize, enable, and disable the object.

              Autocompletion expands strings that have been partially entered in an edit control into complete strings. For example, when a user starts to enter a URL in the Address edit control that is embedded in the Microsoft® Internet Explorer toolbar, autocompletion expands the string into one or more complete URL options that are consistent with the existing partial string. A partial URL string such as "mic" might be expanded to "http://www.microsoft.com" or "http://www.microsoft.com/windows". Autocompletion is typically used with edit controls or with controls that have an embedded edit control, such as the ComboBoxEx control.

              Enabling Autocomplete with SHAutoComplete
              Enabling Autocomplete Manually
              Autocomplete Modes
              Finer Control of CLSID_ACListISF
              Enabling Autocomplete with SHAutoComplete
              The SHAutoComplete function provides autocomplete functionality for an application to attach to an edit control. SHAutoComplete is a very simple function that can autocomplete a file path or URL.

              Enabling Autocomplete Manually
              If you want more detailed control over the autocomplete behavior, or if you want to add a custom source of autocompleted strings, you must manage the autocomplete object yourself.

              Creating a Simple Autocomplete Object
              The following steps show how to create and initialize a simple autocomplete object. A simple autocomplete object completes strings from a single source. Error checking has been intentionally omitted in this example.

              Create the autocomplete object.
              IAutoComplete *pac;
                 CoCreateInstance(CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER,
                                  IID_IAutoComplete, (LPVOID*)&pac);

              Create the autocomplete source.
              You can use a predefined autocomplete source, or you can write your own custom autocomplete source.

              Using a predefined autocomplete source:

              IUnknown *punkSource;
                 CoCreateInstance(clsidSource, NULL, CLSCTX_INPROC_SERVER,
                                  IID_IACList, (LPVOID*)&punkSource);
              The following autocomplete sources are provided by the system.



                Цитата

                CLSID_ACLHistory: An autocomplete source that matches against the URL list in the user's History list.
                CLSID_ACLMRU: An autocomplete source that matches against the URL list in the user's Recently Used list.
                CLSID_ACListISF: An autocomplete source that matches against items in the Shell namespace, including files on the user's computer as well as items in virtual folders such as My Computer and Control Panel.

                Using a custom autocomplete source:

                IUnknown *punkSource;
                   CCustomAutoCompleteSource *pcacs = new CCustomAutoCompleteSource();
                   hr = pcacs->QueryInterface(IID_IUnknown, (void **) &punkSource);
                   pcacs->Release();

                You can write your own autocomplete source object by implementing an object that exposes the IEnumString interface. Implementing the IACList and IACList2 interfaces is optional.

                Set the options on the autocomplete source.
                If you want, you can customize the behavior of the autocomplete source by setting its options. This is particularly useful for the CLSID_ACListISF autocomplete source. For a list of valid options, see the documentation for IACList2::SetOptions.

                IACList2 *pal2;
                   if (SUCCEEDED(punkSource->QueryInterface(IID_IACList2, (LPVOID*)&pal2)))
                   {
                       pal2->SetOptions(ACLO_FILESYSONLY);
                       pal2->Release();
                   }

                Initialize the autocomplete object.
                In this example, hwndEdit is the edit control for which autocomplete is to be enabled, and punkSource is the IUnknown interface pointer created in step 2. For a description of the optional pwszRegKeyPath and pwszQuickComplete parameters, see the documentation for IAutoComplete::Init.

                pac->Init(hwndEdit, punkSource, NULL, NULL);

                Set the options of the autocomplete object.
                If you want, you can customize the behavior of the autocomplete object by setting its options. For a description of the possible options, see the documentation for IACList2::SetOptions.

                IAutoComplete2 *pac2;
                   if (SUCCEEDED(pac->QueryInterface(IID_IAutoComplete2, (LPVOID*)&pac2)))
                   {
                       pac2->SetOptions(ACO_AUTOSUGGEST);
                       pac2->Release();
                   }

                Release the objects.
                pac->Release();
                   punkSource->Release();

                The autocomplete object will remain attached to the edit control even after you release it. You might not want to release these interfaces if you need to access them later. For example, you might want to change the autocomplete options at a later point.

                Creating a Compound Autocomplete Object
                A compound autocomplete object completes strings from multiple sources. For example, the Internet Explorer Address bar uses a compound autocomplete object because the user might type the name of a file in the current folder, or the user might begin typing a URL. The following steps show how to create and initialize a compound autocomplete object:

                Create the autocomplete object.
                IAutoComplete *pac;
                   CoCreateInstance(CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER,
                                    IID_IAutoComplete, (LPVOID*)&pac);

                Create the autocomplete compound source object manager.
                The autocomplete compound source allows multiple autocomplete sources to be combined into a single autocomplete source.

                IObjMgr *pom;
                   CoCreateInstance(CLSID_ACLMulti, NULL, CLSCTX_INPROC_SERVER,
                                    IID_IObjMgr, (LPVOID*)&pom);

                Create and initialize each of the autocomplete sources you want to use.
                Repeat steps 2 and 3 from the Simple Autocomplete Object example as many times as necessary.

                Attach each autocomplete source to the object manager.
                For each autocomplete source you created in step 3, attach it to the object manager.

                pom->Append(punkSource);
                Initialize the autocomplete object.
                This is the same as step 4 of the Simple Autocomplete Object example, except that instead of passing the simple autocomplete source to IAutoComplete::Init, you pass the compound source object manager.

                pac->Init(hwndEdit, pom, NULL, NULL);
                Set the options of the autocomplete object.
                Same as in the simple case.

                Release the objects.
                pac->Release();
                   pom->Release();
                   punkSource->Release(); // repeat for each source you created in step 3

                As in the simple case, you can release the objects as soon as you are finished using them, but you might want to retain the interfaces so you can change options later.


                  Цитата

                  Autocomplete Modes
                  Autocompletion has two modes for displaying the completed string: autoappend and autosuggest. The modes are independent, so you can enable either or both. To specify the mode, call IAutoComplete2::SetOptions.

                  Autoappend: In autoappend mode, autocompletion appends the remainder of the most likely candidate string to the existing characters, highlighting the appended characters. The edit control behaves as if the user had entered the entire string manually and then highlighted the appended characters. If the user continues to enter characters, they are added to the existing partial string. If the user adds a character that is identical to the next highlighted character, the highlighting for that character is turned off. The remaining characters will still be highlighted. If the user adds a character that does not match the next highlighted character, autocompletion attempts to generate a new candidate string based on the larger partial string. It appends the remainder of the new candidate string to the current partial string, as before. If no candidate string can be found, only the typed characters appear and the edit box behaves as it would without autocompletion. This process continues until the user accepts a string.
                  Autosuggest: In autosuggest mode, autocompletion displays a drop-down list, with one or more suggested complete strings, beneath the edit control. The user can select one of the suggested strings, usually by clicking it with the mouse, or continue typing. As typing progresses, the drop-down list might be modified, based on the current partial string. If you set the ACO_SEARCH flag in the dwFlag parameter of IAutoComplete2::SetOptions, autocomplete provides the option to search for the current partial string at the bottom of the drop-down list. It will be displayed even if there are no suggested strings. If the user selects this option, your application should launch a search engine to assist the user.
                  Finer Control of CLSID_ACListISF
                  One reason you might want to retain the interface pointers to the various objects involved in autocomplete is if you want to adjust the behavior dynamically. The most common example of this is with the CLSID_ACListISF object, which autocompletes from the Shell namespace and has the option (ACLO_CURRENTDIR) of enumerating from the current directory as well.

                  An example of a situation where the settings need to be changed dynamically is when Internet Explorer changes the Address bar's current directory whenever you navigate to a new folder.

                  There are two ways to specify the directory that the CLSID_ACListISF object should treat as current. Aside from the way the directory is passed, they are equivalent.

                  In the following, assume that palISF is a pointer to the IACList interface of a CLSID_ACListISF object:

                  Using IPersistFolder:
                  To tell the CLSID_ACListISF object that a particular ITEMIDLIST should be treated as the current directory, you can use the object's IPersistFolder interface. Since an ITEMIDLIST can refer to a virtual folder, this method is more flexible than using ICurrentWorkingDirectory.

                  IPersistFolder *ppf;
                     if (SUCCEEDED(pal->QueryInterface(IID_IPersistFolder, (LPVOID*)&ppf)))
                     {
                         ppf->Initialize(pidlCurrentDirectory);
                         ppf->Release();
                     }

                  Using ICurrentWorkingDirectory:
                  To give the CLSID_ACListISF object a path as the current directory, you can use the object's ICurrentWorkingDirectory interface.

                  ICurrentWorkingDirectory *pcwd;
                     if (SUCCEEDED(pal->QueryInterface(IID_ICurrentWorkingDirectory, (LPVOID*)&pcwd)))
                     {
                         pcwd->SetDirectory(pwszDirectory);
                         pcwd->Release();
                     }



                  Сорри за куски, большие месаджи не пролазят! (пнуть purpe!!)
                  0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
                  0 пользователей:


                  Рейтинг@Mail.ru
                  [ Script execution time: 0,0253 ]   [ 16 queries used ]   [ Generated: 3.05.24, 18:56 GMT ]