Find the answer to your Linux question:
Results 1 to 8 of 8
Hi I want to disply value (which is continously changing) in gtk. There is a function for text which display text:gtk_entry_append_text(GTK_ENTRY(entry1), " "); in a similiar way is there any ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46

    how to display value in GTK

    Hi

    I want to disply value (which is continously changing) in gtk.

    There is a function for text which display text:gtk_entry_append_text(GTK_ENTRY(entry1), " ");

    in a similiar way is there any function to display value..

    Please reply


    regards

    vineeta7

  2. #2
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    You can use labels do to this .

    after declaring the label you do .

    gchar * val = g_strdup_printf("%d", i);

    gtk_label_set_text(GTK_LABEL(label), val );

    If this is no enough for you , and if you want to display a large text something like integrating a terminal debugging output tell me it's possible .

    Regards .
    Linux is not only an operating system, it's a philosophy.
    Archost.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46

    Fragmentation error

    ya i tried it.2 times it was running.Then I got a fragmentation error.How to resolve fragmentation error???

    I am using 1 thread for GTK application (GUI), 1 thread for counter, one more thread for displaying message on command line.

    why to free the car variable????

    And now I am not getting GTK window, when I execute the output file.why this is happening?????

  4. #4
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    If you want to show the same counter you don't have to free the char *val from the memory , so probably this might be your problem .

    about the error, are you getting fragmentation error or segmentation fault !

    you can debug your program by using the GNU debugger , let's say your binary program is called display :

    gdb display

    and then type run , this will start the program and then it'll gives you information about problem .

    continue ( to continue running in case the program produces an error ).

    quit to exit .


    Hope this help
    Regards.
    Linux is not only an operating system, it's a philosophy.
    Archost.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46

    code is attached

    ok ...
    i ll check that through debug

    I want to display a counter which is increamenting by 1 second


    I have attached samspec.cpp samspecCnt.cpp files.Please see attachment.
    when execute o/p.Counter value is not automatically changing in a table.(I need to shake mouse over a table).I am getting error like this.

    (output:5001): Gtk-CRITICAL **: file gtkentry.c: line 3360 (gtk_entry_set_text): assertion `GTK_IS_ENTRY (entry)' failed

    (output:5001): Gtk-CRITICAL **: file gtkentry.c: line 3381 (gtk_entry_append_text): assertion `GTK_IS_ENTRY (entry)' failed

    (output:5001): Gtk-CRITICAL **: file gtkentry.c: line 3360 (gtk_entry_set_text): assertion `GTK_IS_ENTRY (entry)' failed

    (output:5001): Gtk-CRITICAL **: file gtkentry.c: line 3381 (gtk_entry_append_text): assertion `GTK_IS_ENTRY (entry)' failed


    Please reply whether my code is correct or not?? .

    Regards
    vineeta7

    P.S->Do i need to use dynamic memory allocation for storing counter value.
    Attached Files Attached Files

  6. #6
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    It seems the while running the constructure the retMsgThread=pthread_create(&Message_thread,NULL,M essage_fun,(void*)msg1);
    runs before Menu_fun , since you are defining the entry in the second function, then the entry still a GtkWidget structure without being initialized to GtkEntry .

    so entry1 = gtk_entry_new(); has to be executed before writing on it any text .

    Regards.
    Linux is not only an operating system, it's a philosophy.
    Archost.

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    46
    I have added ot mes_fun in while loop byt before mutex lock then i am getting this error:

    (samspec:6290): Gtk-CRITICAL **: file gtktable.c: line 596 (gtk_table_attach): assertion `GTK_IS_WIDGET (child)' failed

    (samspec:6290): Gtk-CRITICAL **: file gtktable.c: line 596 (gtk_table_attach): assertion `GTK_IS_WIDGET (child)' failed

  8. #8
    Linux Engineer aliov's Avatar
    Join Date
    Dec 2006
    Location
    Geneva,Beirut
    Posts
    1,078
    Strange , did you delete the other definition in the Menu_fun function ! well usually i do like this and i never had a problem , well your variables are global and that's fine so !!! make sure that you have the declaration only ones and you didn't put it inside a loop .

    Regards.
    Linux is not only an operating system, it's a philosophy.
    Archost.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...