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

ich habe ein Objekt der klasse CComboBox

nun habe ich in meinem Projekt einen butten eingebunden der folgende funktion aufruft

void CComboDlg::OnSetzen()

{

UpdateData();

m_combo.SetCurSel(2);

UpdateData(FALSE);

}

aber es wird einfach kein anderes feld (in diesem fall feld mit dem Index 2) ausgewählt... ob ich jetzt das 0te oder 10te elemnt vorher angeklickt hab... es passiert einfach nix, wieso nicht???

Hast Du Deiner Combobox neben der Control- als auch eine Value-Variable verpasst?

Wenn ja, liegt es daran:

  1. UpdateData() kopiert den Text aus der ComboBox in Deine Value-Variable.
  2. SetCurSel() ändert die Auswahl.
  3. UpdataData( FALSE ) schreibt den Inhalt der Value-Variablen wieder in die ComboBox, und macht damit Schritt 2 rückgängig.

Da kann sich nichts ändern. ;)

Für Control-Variablen brauchst Du UpdateData normalerweise nicht aufzurufen, denn ein Werteaustausch findet dabei ohnehin nicht statt. Ich würde generell davon abraten, für ein Steuerelement sowohl eine Value- als auch eine Control-Variable einzurichten.

Lass entweder UpdateData( FALSE ) weg, oder entferne die Value-Variable. An den Wert der ComboBox kommst Du auch über die Control-Variable.

  • Autor

hab UpdateData(FALSE) weggelassen. pfunzt...bis jetzt hab ich keine weiteren Probleme mit der Controll und Value Variable... und hab sie jetzt auch schon in mein programm eingebunden => zu faul um sie zu empfernen

hab jedoch schon wieder eine neue frage!

giebt es einen wesentlichen unterschied zwischen CComboBox und CComboBoxEx??

bin über jede hilfe erfreut =))

Danke

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.