flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > [solved] gtk+3 treeview example Goto page 1, 2 Next |
Author |
|
HaHaAnonymous 09 Feb 2014, 16:43
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:16; edited 1 time in total |
|||
09 Feb 2014, 16:43 |
|
sleepsleep 09 Feb 2014, 17:01
just checked my inbox, nothing inside.
|
|||
09 Feb 2014, 17:01 |
|
HaHaAnonymous 09 Feb 2014, 19:25
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:15; edited 1 time in total |
|||
09 Feb 2014, 19:25 |
|
sleepsleep 09 Feb 2014, 19:49
idk what to use, i guess gtk choose me?
but what choices asm got? c gui library only a few, |
|||
09 Feb 2014, 19:49 |
|
HaHaAnonymous 09 Feb 2014, 20:57
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:15; edited 1 time in total |
|||
09 Feb 2014, 20:57 |
|
sleepsleep 09 Feb 2014, 21:06
i am open for suggestions
|
|||
09 Feb 2014, 21:06 |
|
revolution 10 Feb 2014, 00:28
The Windows API supports tree view controls natively. It has supported these ever since the dawn of history itself.
|
|||
10 Feb 2014, 00:28 |
|
sleepsleep 10 Feb 2014, 10:00
ok,
could somebody help me with this gtk3 treeview, i don't get it why it doesn't works =( i follow exactly the c code, afaik, it should works. http://en.wikibooks.org/wiki/GTK%2B_By_Example/Tree_View/Introduction Code: /* * Compile with: * gcc -o helloworld helloworld.c `pkg-config --cflags --libs gtk+-2.0` * */ #include <gtk/gtk.h> enum { COL_NAME = 0, COL_AGE, NUM_COLS } ; static GtkTreeModel * create_and_fill_model (void) { GtkListStore *store; GtkTreeIter iter; store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_UINT); /* Append a row and fill in some data */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, "Heinz El-Mann", COL_AGE, 51, -1); /* append another row and fill in some data */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, "Jane Doe", COL_AGE, 23, -1); /* ... and a third row */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_NAME, "Joe Bungop", COL_AGE, 91, -1); return GTK_TREE_MODEL (store); } static GtkWidget * create_view_and_model (void) { GtkCellRenderer *renderer; GtkTreeModel *model; GtkWidget *view; view = gtk_tree_view_new (); /* --- Column #1 --- */ renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, "Name", renderer, "text", COL_NAME, NULL); /* --- Column #2 --- */ renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, "Age", renderer, "text", COL_AGE, NULL); model = create_and_fill_model (); gtk_tree_view_set_model (GTK_TREE_VIEW (view), model); /* The tree view has acquired its own reference to the * model, so we can drop ours. That way the model will * be freed automatically when the tree view is destroyed */ g_object_unref (model); return view; } int main (int argc, char **argv) { GtkWidget *window; GtkWidget *view; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "delete_event", gtk_main_quit, NULL); /* dirty */ view = create_view_and_model (); gtk_container_add (GTK_CONTAINER (window), view); gtk_widget_show_all (window); gtk_main (); return 0; } |
|||
10 Feb 2014, 10:00 |
|
revolution 10 Feb 2014, 10:20
sleepsleep wrote: could somebody help me with this gtk3 treeview, |
|||
10 Feb 2014, 10:20 |
|
sleepsleep 10 Feb 2014, 11:01
no luck,
i found a 3 source here maybe, http://ubuntuforums.org/showthread.php?t=1760453 i guess the issue is on Code: model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); because Code: model = gtk_tree_store_new(N_COL, G_TYPE_STRING, G_TYPE_STRING); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); g_object_unref(model); but still no success, |
|||
10 Feb 2014, 11:01 |
|
revolution 10 Feb 2014, 11:22
So switch to the well documented Windows API tree view controls instead.
Last edited by revolution on 10 Feb 2014, 11:27; edited 1 time in total |
|||
10 Feb 2014, 11:22 |
|
sleepsleep 10 Feb 2014, 11:26
well,
i just kinda,, frustrated why they could do it but i couldn't. |
|||
10 Feb 2014, 11:26 |
|
gens 10 Feb 2014, 12:32
sleepsleep wrote: well, you are not the only one |
|||
10 Feb 2014, 12:32 |
|
HaHaAnonymous 10 Feb 2014, 12:56
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:14; edited 1 time in total |
|||
10 Feb 2014, 12:56 |
|
sleepsleep 10 Feb 2014, 17:00
i still waiting for your message, HaHaAnonymous..
|
|||
10 Feb 2014, 17:00 |
|
HaHaAnonymous 10 Feb 2014, 20:09
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:14; edited 1 time in total |
|||
10 Feb 2014, 20:09 |
|
sleepsleep 10 Feb 2014, 20:34
HaHaAnonymous wrote:
HaHaAnonymous wrote:
idk, you ask me to check my inbox, maybe whatever, otherwise you already sent to me, i guess, i am talking to myself again.... |
|||
10 Feb 2014, 20:34 |
|
HaHaAnonymous 10 Feb 2014, 21:28
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 18:14; edited 1 time in total |
|||
10 Feb 2014, 21:28 |
|
Gunner 12 Feb 2014, 05:04
Ok let's get this working!
This is not needed: Code: cinvoke g_type_fundamental,16 But if you change this: Code: cinvoke gtk_list_store_new,1,eax To this: Code: cinvoke gtk_list_store_new,1,16 It still won't work. Let's look at the docs for G_TYPE_STRING: Quote: #define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16) Ok, there is a 16 there, but what does G_TYPE_MAKE_FUNDAMENTAL do? Let's see... Quote: #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) Ok getting closer... What is the value of G_TYPE_FUNDAMENTAL_SHIFT? Couldn't find it in the docs, so let's look at the source code: gtype.h: Quote: #define G_TYPE_FUNDAMENTAL_SHIFT (2) BINGO!!! G_TYPE_MAKE_FUNDAMENTAL left shifts by 2. Hmm... lets left shift 16 by 2 and we get 64.. Now we have something to work with. Code: cinvoke gtk_list_store_new,1,64 VOILA!!! We now have properly displaying strings in the treeview!!! May I ask, why you don't just use a GLADE file to create the UI?
_________________ ~Rob (Gunner) Forum Spam List Checker Window Error Lookup Tool and MORE! |
||||||||||
12 Feb 2014, 05:04 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.