frang75 / nappgui_src

SDK for building cross-platform desktop apps in ANSI-C
https://www.nappgui.com
MIT License
506 stars 50 forks source link

Odd combobox behaviour.... #86

Open SamSandq opened 10 months ago

SamSandq commented 10 months ago

I create a Combo like this:

Combo *filter = combo_create();
layout_combo(filtLayout, filter, 3, 0);
combo_add_elem(filter, "1+ stars", NULL);
combo_add_elem(filter, "2+ stars", NULL);
combo_add_elem(filter, "3+ stars", NULL);
combo_add_elem(filter, "4+ stars ", NULL);
combo_add_elem(filter, "5 stars", NULL);
combo_add_elem(filter, "(no filter)", NULL);
combo_add_elem(filter, "(unrated)", NULL);

That works perfectly, and shows:

Screenshot 2024-01-11 at 21 36 42

But what I really want is this:

combo_add_elem(filter, "★%", NULL);
combo_add_elem(filter, "★★%", NULL);
combo_add_elem(filter, "★★★%", NULL);
combo_add_elem(filter, "★★★★%", NULL);
combo_add_elem(filter, "★★★★★", NULL);
combo_add_elem(filter, "(no filter)", NULL);
combo_add_elem(filter, "(unrated)", NULL);

which does not show correctly, as some elements are discarded:

Screenshot 2024-01-11 at 21 37 25

What could be wrong?

frang75 commented 10 months ago

Hi @SamSandq! I add this new case to the ComboBox review.

Related to: https://github.com/frang75/nappgui_src/issues/81 https://github.com/frang75/nappgui_src/issues/68

SamSandq commented 10 months ago

FYI, the popup control works perfectly, and in my case is also better, since I do not wish to be able to edit the values.

However, I noticed that there is no way to access the text of the selected popup choice, only the index. Perhaps a

char_t *txt = popup_text(myPopup);

or

char_t *txt = popup_text(myPopup, index);

could be considered.

frang75 commented 10 months ago

Thanks for update. Therefore, I leave this issue open. Full review of ComboBox is mandatory.

You can get the text of selected Item in OnSelect event as part of EvButton event parameters. But also is a good idea to add const char_t *popup_get_text(const PopUp *popup, const uint32_t index) to public interface. popup_text

SamSandq commented 10 months ago

Yes, I am using that to get the selected text. But what I am after is to get the text of any item using its index.

Cheers, Sam

Sam

Den mån 15 jan. 2024 kl 06:19 skrev Francisco García Collado < @.***>:

Thanks for update. Therefore, I leave this issue open. Full review of ComboBox is mandatory.

You can get the text of selected Item in OnSelect event as part of EvButton event parameters. But also is a good idea to add const char_t popup_get_text(const PopUp popup, const uint32_t index) to public interface. popup_text.png (view on web) https://github.com/frang75/nappgui_src/assets/42999199/7f75c8ed-f492-4f90-969c-4fa92bc5cdc3

— Reply to this email directly, view it on GitHub https://github.com/frang75/nappgui_src/issues/86#issuecomment-1891277653, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMAVI5VJXPANYU5HJJPOYSLYOSU3VAVCNFSM6AAAAABBXBANHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRGI3TONRVGM . You are receiving this because you were mentioned.Message ID: @.***>

frang75 commented 10 months ago

Added popup_get_text() https://github.com/frang75/nappgui_src/commit/8177e951cdb5a0d9670e7a499491d209a8dfbc9c.