Gtk 3.0 Text View Resizable

Gtk 3.0 Text View Resizable

By : Weiyi Wong
Date : September 23 2020, 06:00 AM
it should still fix some issue I am attempting to create a text area so that I can create a text editor but when ever the text reaches the end of the window, it just expands and becomes bigger and looks bad. , By settings wrap mode you stop the text from expanding the window
code :
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(largeEntry), GTK_WRAP_WORD_CHAR);
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>

static GtkTextBuffer *buffer;

void checkEndLine(GtkWidget *text, gpointer data)
  //g_print(":%d ", gtk_text_buffer_get_char_count(GTK_TEXT_BUFFER(buffer)));

static void activate(GtkApplication *app, gpointer user_data)

  GtkWidget *window, *grid, *calculate;

  //Create Grid and Window
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "Menu Test");
  gtk_window_resize(GTK_WINDOW(window), 600, 600);
  g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
  gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
  grid = gtk_grid_new();
  gtk_container_add(GTK_CONTAINER(window), grid);

  //Text Field

  GtkWidget *largeEntry = gtk_text_view_new();
  GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);

  GtkWidget *swindow = gtk_scrolled_window_new(NULL, NULL);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  gtk_container_add(GTK_CONTAINER(swindow), largeEntry);

  gtk_widget_set_size_request(GTK_WIDGET(swindow), 100, 100);
  gtk_widget_set_size_request(GTK_WIDGET(largeEntry), 100, 100);
  gtk_widget_set_size_request(GTK_WIDGET(grid), 300, 300);

  gtk_box_pack_start(GTK_BOX(box), largeEntry, 1, 1, 1);
  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(largeEntry), GTK_WRAP_WORD_CHAR);
  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(largeEntry));
  gtk_text_buffer_set_text(buffer, "He", -1);

  gtk_grid_attach(GTK_GRID(grid), swindow, 0, 1, 1, 1);
  gtk_widget_set_hexpand_set(GTK_WIDGET(largeEntry), FALSE);

  g_signal_connect(GTK_TEXT_BUFFER(buffer), "changed", G_CALLBACK(checkEndLine), NULL);

  //Showing widgets

int main(int argc, char **argv)
  GtkApplication *app;
  int status;

  app = gtk_application_new("com.calculate", G_APPLICATION_FLAGS_NONE);
  g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
  status = g_application_run(G_APPLICATION(app), argc, argv);

  return status;

Share : facebook icon twitter icon
Make a QMainWindow only horizontally-resizable - that is, width is resizable, but height is fixed

Make a QMainWindow only horizontally-resizable - that is, width is resizable, but height is fixed

By : Overpex
Date : March 29 2020, 07:55 AM
Hope that helps I saw another way in one of the examples in a book called "C++ GUI Programming with Qt 4". They did it with
code :
Can I change a non-resizable existing browser window with Javascript to be resizable?

Can I change a non-resizable existing browser window with Javascript to be resizable?

By : user3402817
Date : March 29 2020, 07:55 AM
help you fix your problem Simple question, I have a window that was opened with this code , A hack can be this:
code :
window.open(window.location.href, document.title, 'resizable=yes');
jQuery-UI Resizable: scale all alsoResize elements in proportion with resizable div

jQuery-UI Resizable: scale all alsoResize elements in proportion with resizable div

By : user3739307
Date : March 29 2020, 07:55 AM
I hope this helps you . Maybe you need to rethink the structure..
You could insert the .lyr elements inside the .resizer element and position them inside it with percentage positions .. this way they will automatically resize while their container is changing size. (the plugin does not have to handle them)
code :
newElW = start.width * scaleX;
newElH = start.height * scaleY;
newElL = ((start.left - op.left) * scaleX) + op.left;
newElT = ((start.top  - op.top ) * scaleY) + op.top ;
utils: {
        west: function(start, op, scale, delta) {return ((start.left - op.left) * scale) + op.left + delta.left},
        east: function(start, op, scale, delta) {return ((start.left - op.left) * scale) + op.left;},
        south: function(start, op, scale, delta){return ((start.top  - op.top ) * scale) + op.top; },
        north: function(start, op, scale, delta){return ((start.top  - op.top ) * scale) + op.top + delta.top; }
GWT Trying to get a View to be resizable in Height

GWT Trying to get a View to be resizable in Height

By : GeneFInAustin
Date : March 29 2020, 07:55 AM
Does that help If you want Resizable screens, Use RootLayoutPanel.get().add() method. Add the widgets inside to and don't forget to mention its size in percentages through out the hierarchy. I had the simillar problem. Just check the following link and its accepted answer.
GWT Re-sizing components on browser window resize
How to prevent hiding of the resizable view?

How to prevent hiding of the resizable view?

By : Mihkel Künnapas
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You can use minWidth and minHeight attributes, to limit the minimum size of any view.
code :
    { minHeight:100 },
    { minHeight:100, view:"datatable", data:grid_data, autoConfig:true}
Related Posts Related Posts :
  • How do I know it is OK to free the pointer after passed it to a function?
  • How to get the incoming ssh/telnets clients local IP address from a shell script or C
  • C: What does if(a<b<c) do?
  • What does this mean exactly in C?
  • What is the best way to achieve sscanf-like functionality in Perl?
  • How to create threads and sort correctly in a odd-even sorting program?
  • What's the single best reference on the topic of (POSIX) signals?
  • Avoid Overflow when Calculating π by Evaluating a Series Using 16-bit Arithmetic?
  • How to handle data or char -1 when reading from file, since EOF is also -1
  • Compare every 1kb of contents of two files instead of character by character
  • Understanding functions in stm8s disassembly?
  • Recursive and no-recursive get different answer
  • Can anyone explain the following output of the code?
  • How to resync time from NTP server in esp-idf?
  • Output for the following C code is confusing me
  • Determine if window is visible with High CPU
  • Writing a file by taking input from user only saves value for "x" only
  • How should I fill an array of ints from a file using command line args? The size of the file and the no. of elements may
  • Segmentation Fault While Reading File in C
  • Fill an array at index n with m times data without bit-fields
  • Why don't the values I type in the terminal match the values I've already stored in the array?
  • MPLABX XC16 unable to resolve built-in identifier __builtin_dmaoffset
  • How call and compile function from elf to my binary?
  • Modifying non-const char array that is referred to by const char array
  • Does anyone see any mistakes here? I am trying to get a message via a pipe, from my parent to child
  • Memory Leak - Singly linked list in C
  • Trouble with translation of typedef between C to D
  • Why does SIGINT stop sleep more than one time?
  • How to pause a timer created with CreateTimerQueueTimer
  • How can I read data from file ? I can't fix it
  • Scanf in visual studio not accepting multiple cases of characters
  • How can I determine if a char* is a windows line ending?
  • I am trying to store value in long long int type but giving wrong return
  • How to manage different kinds of data in a linked list?
  • uint8_t not rollover to 0 after reaching 255 not working properly
  • Why do these two execvp produce different results?
  • Pass uintmax_t or size_t to custom printf conversion specifier
  • Why does free() leaves stuff in memory?
  • Why pointers can't be used to index arrays?
  • memory allocation eror in C
  • C custom datatypes mapped to C datatypes grouped under a single struct
  • pipe() data is not transferred to child process
  • Getting a core dump from a simple C program
  • Fatal error on makefile, need to understand the problem
  • How can I add a delay of 90 minutes when a port has gone from 0 to 1?
  • To use strcpy or not
  • the usage of strtok() in c shows warnings and returns segmentation fault(core dumped)
  • Trouble allocating array of structs
  • Only first char of user input used in array
  • Why does "int x = 5; printf("%d %d %d", x==5, x=10, x==5);" in C print "0 10 0"?
  • How to scan specific string format in C?
  • sscanf skipping the final value when reading multiple values from a line
  • How can I access full memory space in FreeDOS with C application
  • Semantics of sem_getvalue() in POSIX
  • What does the [x,y] symbol mean in a multidimensional array access?
  • compilation error: cast from pointer to integer of different size
  • why am i getting compilation error "error: conflicting types for ‘ptr’ " for the following code? static int va
  • Why does getw return -1 when trying to read a character?
  • Why C program in whch two functions call each other recursively gives segmentation fault on linux?
  • ssize_t is undefined
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk