user12207810
user12207810

Reputation:

How to correctly set default text with GTK 3

I've tried everything but I'm so lost. Here is what I need to achieve:

    backupDirs = gtk_entry_new();
    gtk_grid_attach(GTK_GRID(grid), backupDirs, 1, 1, 1, 1);
    gtk_entry_set_placeholder_text(*backupDirs,"Placeholder text here");

I don't understand how to correctly pass the string into the function.

Upvotes: 0

Views: 486

Answers (1)

ekalin
ekalin

Reputation: 1012

You need to pass a pointer to a GtkEntry as the first argument of gtk_entry_set_placeholder_text. You didn't show your declaration of backupDirs, but since gtk_entry_new returns a GtkWidget *, I assume it's something like

GtkWidget *backupDirs = gtk_entry_new()

So you need to cast it to GtkEntry *, using the built-in macros:

gtk_entry_set_placeholder_text(GTK_ENTRY(backupDirs), "Placeholder text here");

Upvotes: 0

Related Questions