Jak w WinApi wstawić Toolbara do RebarWindows ?

0

Jak w WinApi wstawić Toolbara do RebarWindows ?

Źródło znajduje się :
http://4programmers.net/download.html?id=1118

mam nadzieje , że ktoś mi coś poradzi jak to zrobić w WinApi ?

0

Wystarczy poczytać (Platform SDK):

RB_INSERTBAND Message


Inserts a new band in a rebar control.

Syntax

To send this message, call the SendMessage function as follows.
lResult = SendMessage( * returns LRESULT in lResult (HWND) hWndControl, * handle to destination control (UINT) RB_INSERTBAND, * message ID (WPARAM) wParam, * = (WPARAM) (UINT) uIndex; (LPARAM) lParam // = (LPARAM) (LPREBARBANDINFO) lprbbi; );
Parameters

uIndex
Zero-based index of the location where the band will be inserted. If you set this parameter to -1, the control will add the new band at the last location.
lprbbi
Pointer to a REBARBANDINFO structure that defines the band to be inserted. You must set the cbSize member of this structure to sizeof(REBARBANDINFO) before sending this message.
Return Value

Returns nonzero if successful, or zero otherwise.

Message Information

Minimum DLL Version comctl32.dll version 4.70 or later
Header commctrl.h
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 3.0, Windows 98, Windows 95 with Internet Explorer 3.0

0

Cieszę się bardzo SZYMON , że zainteresowałeś się moim problemem ale niestety nie przejrzałeś linka wraz z źródłem. Funkcja którą wyciąłeś z SDK została zastosowana w moim przykładzie :
SendMessage(Opakowanie, RB_INSERTBAND, WPARAM(-1), integer(@rbBand));

Pytanie brzmi :
Jak w WinApi wstawić Toolbara do RebarWindows ?

Czyli :
Tworze ToolBara i chcę aby był zamieszczony w RebarWindows a nie jak jest teraz , że ToolBar przykrywa RebarWindows.

W SDK znalazłem takie stwierdzenie , że należy stworzyć RebarWindows i wstawić ToolBara a jak - to się nawet nie zająknęli. Prawdopodobnie jest jakiś mechanizm w Visual C++ , który to realizuje i dlatego nic nie napisali, nie mam pojęcia.

W Delphi to inna bajka żadnych informacji , żadnych pomocy.

Może ktoś się zetknął się z tym problemem lub ma jakiś przykład w Delphi WinApi jak to zrealizować.

0

Przecież jest tam przkład gdzie jest ToolBar a obok niego ComboBox:

user image

Tylko trzeba sobie z C przełożyć.

HWND WINAPI CreateRebar(HWND hwndOwner)
{
   REBARINFO     rbi;
   REBARBANDINFO rbBand;
   RECT          rc;
   HWND   hwndCB, hwndTB, hwndRB;
   DWORD  dwBtnSize;
   INITCOMMONCONTROLSEX icex;
   
   icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
   icex.dwICC   = ICC_COOL_CLASSES|ICC_BAR_CLASSES;
   InitCommonControlsEx(&icex);
   hwndRB = CreateWindowEx(WS_EX_TOOLWINDOW,
                           REBARCLASSNAME,
                           NULL,
                           WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|
                           WS_CLIPCHILDREN|RBS_VARHEIGHT|
                           CCS_NODIVIDER,
                           0,0,0,0,
                           hwndOwner,
                           NULL,
                           g_hinst,
                           NULL);
   if(!hwndRB)
      return NULL;
   // Initialize and send the REBARINFO structure.
   rbi.cbSize = sizeof(REBARINFO);  // Required when using this
                                    // structure.
   rbi.fMask  = 0;
   rbi.himl   = (HIMAGELIST)NULL;
   if(!SendMessage(hwndRB, RB_SETBARINFO, 0, (LPARAM)&rbi))
      return NULL;
   // Initialize structure members that both bands will share.
   rbBand.cbSize = sizeof(REBARBANDINFO);  // Required
   rbBand.fMask  = RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND | 
                   RBBIM_STYLE | RBBIM_CHILD  | RBBIM_CHILDSIZE | 
                   RBBIM_SIZE;
   rbBand.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDBMP;
   rbBand.hbmBack = LoadBitmap(g_hinst,
                              MAKEINTRESOURCE(IDB_BACKGRND));   
   // Create the combo box control to be added.
   hwndCB = CreateComboBox(hwndRB);
   // Set values unique to the band with the combo box.
   GetWindowRect(hwndCB, &rc);
   rbBand.lpText     = "Combo Box";
   rbBand.hwndChild  = hwndCB;
   rbBand.cxMinChild = 0;
   rbBand.cyMinChild = rc.bottom - rc.top;
   rbBand.cx         = 200;
   
   // Add the band that has the combo box.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
   
   // Create the toolbar control to be added.
   hwndTB = CreateToolbar(hwndOwner, dwStyle);
   
   // Get the height of the toolbar.
   dwBtnSize = SendMessage(hwndTB, TB_GETBUTTONSIZE, 0,0);

   // Set values unique to the band with the toolbar.
   rbBand.lpText     = "Tool Bar";
   rbBand.hwndChild  = hwndTB;
   rbBand.cxMinChild = 0;
   rbBand.cyMinChild = HIWORD(dwBtnSize);
   rbBand.cx         = 250;

   // Add the band that has the toolbar.
   SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
   return (hwndRB);
}

0

22.08.2003
No tak ten przykład widziałem faktycznie, ale nigdy nie tworzyłem ToolBara przez funkcję : CreateToolbar;

Ja tworzę to tak :

 narzedzia:=CreateWindowEx(
        WS_EX_TOOLWINDOW,
        TOOLBARCLASSNAME,
        pchar('ARKADIUSZ BIERNACKI'),
        WS_CHILD or TBSTYLE_TOOLTIPS  or WS_BORDER or TBSTYLE_FLAT,
        50, 50,
        50, 50,
        Hokno, 555, hinstance, nil);

i dalej reszta jest w linku.

Ok SZYMON sprubóję to stworzyć przez CreateToolbar ale to dopiero po pracy.
Jeśli możesz, to czy mógłbyś napisać jak to stworzyć przez funkcję CreateToolbar ?

Pozdrowienia.

25.08.2003
Sprawdziłem czegoś takiego w Delphi nie ma :
// Create the combo box control to be added.
hwndCB = CreateComboBox(hwndRB);
// Create the toolbar control to be added.
hwndTB = CreateToolbar(hwndOwner, dwStyle);

Więc niestety SDK nie jest zawsze pomocne i problem jak był tak jest !!!

Może ktoś ma jakieś pomysły ?

1 użytkowników online, w tym zalogowanych: 0, gości: 1