Adressleiste will nicht



  • hallo, weiss jemand Rat ? Möchte eine Adressleiste wie im Browser. Habe dazu nachfolgenden Code benutzt, aber das Adressfeld ist nicht editierbar. D.h. wenn man die Combobox mit der Maus anklickt, wird der gesamte Text ausgewählt, und ein Cursor ist nicht sichtbar. Rechts-Links-Tasten bewirken nichts. Vielleicht weiß jemand, was ich ändern muss oder weiss einen besseren Code dafür:

    BOOL create_addressBar(HWND hwnd, HINSTANCE hInstance, LPCTSTR string)
    {
    HWND hwndCB, hwndTB=NULL, hwndRB;
    REBARINFO rbi;
    RECT rc;
    REBARBANDINFO rbBand;
    long dwBtnSize=0;
    INITCOMMONCONTROLSEX icex;

    icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    icex.dwICC = ICC_BAR_CLASSES;
    InitCommonControlsEx(&icex);
    if (!(hwndRB=CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL,
    WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|
    WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_NODIVIDER|RBS_REGISTERDROP,
    2 + 70 + 10, 2, // X, Y position
    70, 34, // Width, Height
    hwnd,
    (HMENU)2001, hInstance, 0)))
    {
    tbx_geterror();
    MessageBox(hwnd, "Can't create browser child window!", "ERROR", MB_OK);
    return FALSE;
    }

    // Initialize and send the REBARINFO structure.
    rbi.cbSize = sizeof(REBARINFO); // Required when using this
    // structure.
    rbi.fMask = 0;
    rbi.himl = (HIMAGELIST)NULL;
    SendMessage(hwndRB, RB_SETBARINFO, 0, (LPARAM)&rbi);
    // 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(hInstance,MAKEINTRESOURCE(700));
    // Create the combo box control to be added.

    hwndCB = CreateWindowEx(WS_EX_TOOLWINDOW, "ComboBox", NULL,
    WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
    2, 2, // X, Y position
    10, 20, // Width, Height
    hwnd,
    (HMENU)2002, hInstance, 0);
    SendMessage( hwndCB, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) string );
    SetWindowText(hwndCB, string);
    // Set values unique to the band with the combo box.
    GetWindowRect(hwndCB, &rc);
    rbBand.lpText = "Address";
    rbBand.hwndChild = hwndCB;
    rbBand.cxMinChild = 0;
    rbBand.cyMinChild = rc.bottom - rc.top;
    rbBand.cx = 200;

    SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

    CreateMyFont();
    if (FontHandle) DeleteObject(FontHandle);

    return TRUE;
    }



  • Ich bin mir jetzt nicht sicher, aber braucht die ComboBox nicht einen der CBS_ - Stile ?

    Versuchs mal mit CBS_DROPDOWN oder liege ich da falsch. 😕


Anmelden zum Antworten