Listbox-Styles ändern?



  • Hi, Leutz!

    Mal ne Frage, ich habe eine Listbox, und möchte (je nach Aktion) deren Style ändern, also z.B. sortiert/unsortiert usw.. Wenn ich die box erzeuge, geben ich als styles WS_CHILD | WS_VISIBLE | ES_LEFT | WS_VSCROLL an.

    Naja, also hab ich hier mal gesucht und auch den Thread http://www.c-plusplus.net/forum/viewtopic.php?t=16505&highlight=lbssort gefunden. Aber das dort gezeigte Beispiel funzt nicht, da mein Compiler (C++ Builder) kein SetWindowLongPtr findet, wohl aber ein SetWindowLong. Wenn ich aber jetzt versuche, mit

    SetWindowLong(hListBox_List, GWL_STYLE, LBS_SORT | GetWindowLong(hListBox_List, GWL_STYLE) );
    

    oder auch mit

    SetWindowLong(hListBox_List, GWL_STYLE, WS_CHILD | WS_VISIBLE | ES_LEFT | WS_VSCROLL | LBS_SORT);
    

    die Listbox auf sortiert zu setzen, passiert nix, also die Einträge bleiben unsortiert 😞

    Könnt ihr mir helfen??

    Grüsse, ~cp code_pilot



  • code_pilot schrieb:

    Aber das dort gezeigte Beispiel funzt nicht, da mein Compiler (C++ Builder) kein SetWindowLongPtr findet, wohl aber ein SetWindowLong.

    Ein SDK-Update könnte hier Wunder wirken :p Aber vielleicht liegts daran:

    Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly.


Anmelden zum Antworten