Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

ich versuche einer Toolbar zur Laufzeit einen neuen Button hinzuzufügen.

Das Bild des Buttons soll aus einer Bitmapdatei aus den Resourcen ausgelesen werden.

Das ganze habe ich wie folgt realisiert:


CToolBar *_wndToolBar = &((CMainFrame*)GetParent())->m_wndToolBar;
CToolBarCtrl *_ctrlToolBar = &_wndToolBar->GetToolBarCtrl();

int nButCount = _ctrlToolBar->GetButtonCount();

_ctrlToolBar->AddBitmap(1,IDB_BITMAP1);

int nStringCount = _ctrlToolBar->AddStrings("Test");

int nImgCount = _ctrlToolBar->GetImageList()->GetImageCount();

TBBUTTON tb;
tb.iBitmap = nImgCount-1;
tb.idCommand = ID_TEST;
tb.fsState = TBSTATE_ENABLED;
tb.fsStyle = TBSTYLE_BUTTON;
tb.dwData = 0;
tb.iString = nStringCount;

_ctrlToolBar->InsertButton(nButCount, &tb);

[/PHP]

Das ganze klappt aber leider nur so halb:

Wenn die Methode durchlaufen wurde, sieht man erstmal gar keine Veränderung, klickt man aber auf die Toolbar, so wird der neue Button sichtbar.

Gibt es irgendeine Methode mit der die Anzeige der Toolbar aktualisiert wird?

Ich habe es schon mit _ctrlToolBar->RedrawWindow und mit _ctrlToolBar->AutoSize() versucht, leider ohne Erfolg.

Achso, ich benutze Visual C++ 6.

Schonmal besten Dank im Voraus

Matthes

leider klappt das auch nicht :(

Leider auch nicht.

Ist der Teil in dem ich den Button hinzufüge denn OK?

Vielleicht liegts ja auch daran :confused:

Ich hab nämlich auch das komische Phänomen, dass die Buttons alle breiter werden, wenn ich einen zweiten Button neu einfüge.

Das aktualisieran der Anzeige habe ich jetzt mit GetParentFrame()->RecalcLayout(); hinbekommen.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.