[GTK4 C] Is it possible to specify a larger minimal value for a gtk_entry?

Hello, my application uses a gtk_entry to enter a numeric search value and its minimal width is too small to display values having 3 digits. I tried to put a placeholder value (123) but it has no effect on minimal width. My UI is simple, only a header_bar where I add my widgets on a gtk_box with GTK_ORIENTATION_HORIZONTAL.

  eRech = gtk_entry_new();
  gtk_entry_set_placeholder_text(GTK_ENTRY(eRech), "123");
  gtk_box_append (GTK_BOX (box), eRech);

I would also like to do is to have this gtk_entry always has the focus so that it can accept user keystrokes, it would make my application process better as most of times. I can maybe add code to give it the focus after each redraw of current page ?

And one other thing concerns what this gtk_entry is used for : when the user enters a value and press enter key, the current page is redrawn and if the entered value is found it is highlighted. Sadly Cairo has nothing to highlight text, so I’m writing it in red. Is there a way I could have something that would be easier to see ? My main problem is that text can be rotated and also the piece, so I would need to keep tracks of all those potential rotations (and zoom factor and also text size) to have correct coordinates. Maybe could I use something else than Cairo to view my pages (I’m using Cairo for that but it’s really only needed when I export to vector graphic file) ?


(the gtk_entry is on the top and has 76 on it that is a cropped 176, you can see 176 in red into the page)

A lot of questions. You may start with Gtk.Editable.set_width_chars.

Thanks a lot, its works. I didn’t thought to look on Gtk.Editable.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.