WIP: calls.on_clicked_MENU() prints a list-box children: three buttons'labels

This commit is contained in:
Jean Sirmai 2024-07-13 20:20:51 +02:00
parent 883bc5f311
commit aaf8777299
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 12 additions and 10 deletions

View File

@ -350,11 +350,13 @@ void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
void on_clicked_MENU (GtkWidget *btt_reset, gpointer list_box) void on_clicked_MENU (GtkWidget *btt_reset, gpointer list_box)
{ {
printf ("callback.on_clicked_MENU() button > %p < &list_box > %p, %p, %p \n",\ if (gtk_list_box_get_row_at_index (list_box, 3))
list_box, printf ("callback.on_clicked_MENU() button > %p < &list_box > children nb > 3\n", list_box);
gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 0)), else printf ("callback.on_clicked_MENU() button > in list_box are the three buttons : %s, %s, %s\n\
gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 1)), and now : how to display these three buttons (and make use of them) ? 2024-07-13 (20h)\n",\
gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 2))); gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 0)))),
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 1)))),
gtk_button_get_label (GTK_BUTTON (gtk_list_box_row_get_child (gtk_list_box_get_row_at_index (list_box, 2)))));
// learning_how_to_create_a_menu (menu_button); // learning_how_to_create_a_menu (menu_button);
// https://docs.gtk.org/gtk4/class.ListBox.html // https://docs.gtk.org/gtk4/class.ListBox.html

View File

@ -172,11 +172,11 @@ static void window_header_bar (GtkWindow *window, char *title)
GtkWidget* list_box = gtk_list_box_new(); GtkWidget* list_box = gtk_list_box_new();
// GtkButton *menu_item_A = GTK_BUTTON (gtk_button_new_with_label ("item_A")); gtk_list_box_append (GTK_LIST_BOX (list_box), menu_item_A); GtkWidget *menu_item_A = GTK_WIDGET (gtk_button_new_with_label ("button_A")); gtk_list_box_append (GTK_LIST_BOX (list_box), menu_item_A);
// GtkButton *menu_item_B = GTK_BUTTON (gtk_button_new_with_label ("item_B")); gtk_list_box_append (GTK_LIST_BOX (list_box), menu_item_B); GtkWidget *menu_item_B = GTK_WIDGET (gtk_button_new_with_label ("button_B")); gtk_list_box_append (GTK_LIST_BOX (list_box), menu_item_B);
gtk_list_box_append (GTK_LIST_BOX (list_box), gtk_label_new ("menu_item_A")); GtkWidget *menu_item_C = GTK_WIDGET (gtk_button_new_with_label ("button_C")); gtk_list_box_append (GTK_LIST_BOX (list_box), menu_item_C);
gtk_list_box_append (GTK_LIST_BOX (list_box), gtk_label_new ("menu_item_B")); // GtkWidget *menu_item_D = GTK_WIDGET (gtk_button_new_with_label ("button_D")); gtk_list_box_append (GTK_LIST_BOX (list_box), menu_item_D);
gtk_list_box_append (GTK_LIST_BOX (list_box), gtk_label_new ("menu_item_C")); // gtk_list_box_append (GTK_LIST_BOX (list_box), gtk_label_new ("any text"));
GtkButton *open_menu = GTK_BUTTON (gtk_button_new ()); // gtk_button_new or gtk_menu_button_new ? GtkButton *open_menu = GTK_BUTTON (gtk_button_new ()); // gtk_button_new or gtk_menu_button_new ?
gtk_button_set_icon_name (GTK_BUTTON (open_menu), "open-menu-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (open_menu), "open-menu-symbolic");