Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Corsair Vanguard Air 99 Wireless: non si era mai vista una tastiera gaming così professionale
Corsair Vanguard Air 99 Wireless: non si era mai vista una tastiera gaming così professionale
Nelle ultime settimane abbiamo provato la Corsair Vanguard Air 99 Wireless, una tastiera tecnicamente da gaming, ma che in realtà offre un ampio ventaglio di possibilità anche al di fuori delle sessioni di gioco. Flessibilità e funzionalità sono le parole d'ordine di una periferica che si rivolge a chi cerca un prodotto capace di adattarsi a ogni esigenza e ogni piattaforma
Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lavaggio è ampio
Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lavaggio è ampio
DEEBOT T90 PRO OMNI abbina un sistema di aspirazione basato su tecnologia BLAST ad un rullo di lavaggio dei pavimenti dalla larghezza elevata, capace di trattare al meglio le superfici di casa minimizzando i tempi di lavoro. Un robot completo che riesce anche ad essere sottile e garantire automazione ed efficienza nelle operazioni di pulizia di casa
Recensione Samsung Galaxy S26 Ultra: finalmente qualcosa di nuovo
Recensione Samsung Galaxy S26 Ultra: finalmente qualcosa di nuovo
Per diversi giorni il Galaxy S26 Ultra di Samsung è stato il nostro compagno di vita. Oltre alle conferme del colosso coreano come la qualità del display e una suite AI senza rivali, arriva il Privacy Display, un unicum nel mondo smartphone. Ci sono ancora alcuni gap che non sono riusciti a colmare lato batteria e fotocamera, seppur con alcuni miglioramenti.
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 03-09-2003, 00:08   #1
x110
Senior Member
 
Iscritto dal: May 2002
Città: Massa Carrara
Messaggi: 589
gtk liste perche' non va ?

il programmino funziona,,,
ma quando dovrebbe aggiungere elementi dalla lista o fare altre azioni
le gtk in consolle mi danno strani errori.....
Codice:
/* example-start clist clist.c */

#include <gtk/gtk.h>
#include <glib.h>

/* These are just the prototypes of the various callbacks */
void button_add_clicked( GtkWidget *button, gpointer data);
void button_clear_clicked( GtkWidget *button, gpointer data);
void button_hide_show_clicked( GtkWidget *button, gpointer data);
void selection_made( GtkWidget *clist, gint row, gint column,
                     GdkEventButton *event, gpointer data);

gint main (int argc, gchar *argv[])
{
    GtkWidget       *window;
    GtkWidget       *vbox, *hbox;
    GtkWidget       *clist;
    GtkWidget       *button_add, *button_clear, *button_hide_show;
    gchar           *titles[2] = {"Ingredients","Amount"};

    gtk_init(&argc, &argv);


    window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_usize(GTK_WIDGET(window), 300, 150);

    gtk_window_set_title(GTK_WINDOW(window), "GtkCList Example");
    gtk_signal_connect(GTK_OBJECT(window),
                       "destroy",
                       GTK_SIGNAL_FUNC(gtk_main_quit),
                       NULL);

    vbox=gtk_vbox_new(FALSE, 5);
    gtk_container_border_width(GTK_CONTAINER(vbox), 5);
    gtk_container_add(GTK_CONTAINER(window), vbox);
    gtk_widget_show(vbox);

    /* Create the GtkCList. For this example we use 2 columns */
    clist = gtk_clist_new_with_titles( 2, titles);

    /* When a selection is made, we want to know about it. The callback
     * used is selection_made, and its code can be found further down */
    gtk_signal_connect(GTK_OBJECT(clist), "select_row",
                       GTK_SIGNAL_FUNC(selection_made),
                       NULL);

    /* It isn't necessary to shadow the border, but it looks nice :) */
    //gtk_clist_set_border(GTK_CLIST(clist), GTK_SHADOW_OUT);

    /* What however is important, is that we set the column widths as
     * they will never be right otherwise. Note that the columns are
     * numbered from 0 and up (to 1 in this case).
     */
    gtk_clist_set_column_width (GTK_CLIST(clist), 0, 150);

    /* Scollbars _only when needed_ */
    //gtk_clist_set_policy(GTK_CLIST(clist), GTK_POLICY_AUTOMATIC,
    //                                       GTK_POLICY_AUTOMATIC);

    /* Add the GtkCList widget to the vertical box and show it. */
    gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
    gtk_widget_show(clist);

    /* Create the buttons and add them to the window. See the button
     * tutorial for more examples and comments on this.
     */
    hbox = gtk_hbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
    gtk_widget_show(hbox);

    button_add = gtk_button_new_with_label("Add List");
    button_clear = gtk_button_new_with_label("Clear List");
    button_hide_show = gtk_button_new_with_label("Hide/Show titles");

    gtk_box_pack_start(GTK_BOX(hbox), button_add, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button_clear, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button_hide_show, TRUE, TRUE, 0);

    /* Connect our callbacks to the three buttons */
    gtk_signal_connect_object(GTK_OBJECT(button_add), "clicked",
                              GTK_SIGNAL_FUNC(button_add_clicked),
                              (gpointer) clist);
    gtk_signal_connect_object(GTK_OBJECT(button_clear), "clicked",
                              GTK_SIGNAL_FUNC(button_clear_clicked),
                              (gpointer) clist);
    gtk_signal_connect_object(GTK_OBJECT(button_hide_show), "clicked",
                              GTK_SIGNAL_FUNC(button_hide_show_clicked),
                              (gpointer) clist);

    gtk_widget_show(button_add);
    gtk_widget_show(button_clear);
    gtk_widget_show(button_hide_show);

    /* The interface is completely set up so we show the window and
     * enter the gtk_main loop.
     */
    gtk_widget_show(window);
    gtk_main();

    return 0;
};

/* User clicked the "Add List" button. */
void button_add_clicked( GtkWidget *button, gpointer data)
{
    int         indx;

    /* Something silly to add to the list. 4 rows of 2 columns each */
    gchar      *drink[4][2] = {{"Milk", "3 Oz"},
                               {"Water", "6 l"},
                               {"Carrots", "2"},
                               {"Snakes", "55"}};

    /* Here we do the actual adding of the text. It's done once for
     * each row.
     */
    for( indx=0; indx < 4; indx++)
        gtk_clist_append( (GtkCList*) data, drink[indx]);

    return;
};

/* User clicked the "Clear List" button. */
void button_clear_clicked( GtkWidget *button, gpointer data)
{
    /* Clear the list using gtk_clist_clear. This is much faster than
     * calling gtk_clist_remove once for each row.
     */
    gtk_clist_clear((GtkCList*) data);

    return;
};

/* The user clicked the "Hide/Show titles" button. */
void button_hide_show_clicked( GtkWidget *button, gpointer data)
{
    /* Just a flag to remember the status. 0 = currently visible */
    static short int flag = 0;

    if (flag == 0)
    {
        /* Hide the titles and set the flag to 1 */
        gtk_clist_column_titles_hide((GtkCList*) data);
        flag++;
    }
    else
    {
        /* Show the titles and reset flag to 0 */
        gtk_clist_column_titles_show((GtkCList*) data);
        flag--;
    }

    return;
};

/* If we come here, then the user has selected a row in the list. */
void selection_made( GtkWidget *clist, gint row, gint column,
                     GdkEventButton *event, gpointer data)
{
    gchar       *text;

    /* Get the text that is stored in the selected row and column
     * which was clicked in. We will receive it as a pointer in the
     * argument text.
     */
    gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);

    /* Just prints some information about the selected row */
    g_print("You selected row %d. More specifically you clicked in column %d, and the text in this cell is %s\n\n", row, column, text);

    return;
}
x110 è offline   Rispondi citando il messaggio o parte di esso
Old 03-09-2003, 16:31   #2
mjordan
Bannato
 
L'Avatar di mjordan
 
Iscritto dal: Mar 2002
Città: Pescara - 未婚・恋人なし Moto: Honda CBR 1000 RR ‫Casco: XR1000 Diabolic 3
Messaggi: 27578
Sarebbe stato meglio elencare gli errori , tu che dici???
mjordan è offline   Rispondi citando il messaggio o parte di esso
Old 03-09-2003, 16:32   #3
mjordan
Bannato
 
L'Avatar di mjordan
 
Iscritto dal: Mar 2002
Città: Pescara - 未婚・恋人なし Moto: Honda CBR 1000 RR ‫Casco: XR1000 Diabolic 3
Messaggi: 27578
A proposito, stai studiando sul libro che ti diedi io??? Donna O' Martins??
mjordan è offline   Rispondi citando il messaggio o parte di esso
Old 03-09-2003, 19:19   #4
x110
Senior Member
 
Iscritto dal: May 2002
Città: Massa Carrara
Messaggi: 589
non sto studiando su quel libro,,,sorry
ridammi il link dove lo si puo comprare per cortesia.

gli errori che mi da sono in fase di compilazione non mi riconosce 2 funzioni che ho
remmato,
a run time cliccando sul primo tasto mi dice:

(gtk:5518): Gtk-CRITICAL **: file gtkclist.c: line 2667 (gtk_clist_append): assertion `GTK_IS_CLIST (clist)' failed

(gtk:5518): Gtk-CRITICAL **: file gtkclist.c: line 2667 (gtk_clist_append): assertion `GTK_IS_CLIST (clist)' failed

(gtk:5518): Gtk-CRITICAL **: file gtkclist.c: line 2667 (gtk_clist_append): assertion `GTK_IS_CLIST (clist)' failed

(gtk:5518): Gtk-CRITICAL **: file gtkclist.c: line 2667 (gtk_clist_append): assertion `GTK_IS_CLIST (clist)' failed

il problema e' sicuramente nel modo in cui i parametri vengono passati
perche' se io lavoro sulla lista direttamente senza passare il puntatore della lista
ad un'altra funzione tutto va liscio, eccetto per

/* Scollbars _only when needed_ */
//gtk_clist_set_policy(GTK_CLIST(clist), GTK_POLICY_AUTOMATIC,
// GTK_POLICY_AUTOMATIC);

/* It isn't necessary to shadow the border, but it looks nice */
//gtk_clist_set_border(GTK_CLIST(clist), GTK_SHADOW_OUT);

grazie.

Ultima modifica di x110 : 04-09-2003 alle 09:26.
x110 è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Corsair Vanguard Air 99 Wireless: non si era mai vista una tastiera gaming così professionale Corsair Vanguard Air 99 Wireless: non si era mai...
Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lavaggio è ampio Ecovacs DEEBOT T90 PRO OMNI: ora il rullo di lav...
Recensione Samsung Galaxy S26 Ultra: finalmente qualcosa di nuovo Recensione Samsung Galaxy S26 Ultra: finalmente ...
Diablo II Resurrected: il nuovo DLC Reign of the Warlock Diablo II Resurrected: il nuovo DLC Reign of the...
Deep Tech Revolution: così Area Science Park apre i laboratori alle startup Deep Tech Revolution: così Area Science P...
NVIDIA RTX PRO 4500 Server Edition: la s...
Core Ultra 200 HX Plus: Intel mette il t...
Starfield arriva su PS5: data ufficiale,...
iPad Air 13" (M4) scende di prezzo: -100...
Oracle annuncia Java 26 con il Java Veri...
OPPO Find N6 è ufficiale: sottile...
Influencer sotto controllo Agcom: arriva...
Scontro in OpenAI sul ChatGPT per adulti...
Apple Watch Series 11 a 349€ e altri int...
Starlink rinnova i piani residenziali in...
POCO X8 Pro e Pro Max ufficiali: potenza...
Jensen Huang propone i token come nuovo ...
Realme 16 Pro e 16 Pro+ tra i più...
Dall'enciclopedia all'algoritmo: Encyclo...
Il CEO di Epic Games Tim Sweeney ha comp...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 21:58.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v