Is there any way to Paste Text into a Screen Window after using Copy from the Clipboard like another program such as a WP or Notepad?
Likewise can we create a Text Window to Copy from to Paste elsewhere?
Copy and Paste Text
Re: Copy and Paste Text
This creates a window with a multi line text editor in monospace font with scrollbars, filled by its own source code. Right-click to get a pop-up for copy /paste.
Code: Select all
' TXTVW.BAS
' by TJF (2014)
#DEFINE __USE_GTK3__
#INCLUDE ONCE "gtk/gtk.bi"
gtk_init (NULL, NULL)
VAR win = gtk_window_new (GTK_WINDOW_TOPLEVEL)
gtk_widget_set_size_request (win, 500, 450)
g_signal_connect (G_OBJECT (win), "destroy", _
G_CALLBACK (@gtk_main_quit), NULL)
gtk_window_set_title (GTK_WINDOW (win), "Text Widget Example for Sigord")
gtk_container_set_border_width (GTK_CONTAINER (win), 5)
VAR scroll = gtk_scrolled_window_new (NULL, NULL)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), _
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC)
gtk_container_add (GTK_CONTAINER (win), scroll)
gtk_widget_show (scroll)
VAR text = gtk_text_view_new ()
gtk_text_view_set_editable (GTK_TEXT_VIEW (text), TRUE)
gtk_container_add (GTK_CONTAINER (scroll), text)
gtk_widget_show (text)
VAR panfo = pango_font_description_from_string("monospace 10")
gtk_widget_modify_font(GTK_WIDGET(text), panfo)
pango_font_description_free(panfo)
VAR buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (text))
DIM AS GTKTextIter iter
gtk_text_buffer_get_iter_at_offset(buffer, @Iter, 0)
VAR inbuf = "", fnam = "TXTVW.BAS", fnr = FREEFILE
IF OPEN (fnam FOR INPUT AS #fnr) THEN
inbuf = "Cannot open " & fnam & "!"
ELSE
inbuf = STRING(LOF(fnr), 0)
GET #fnr, , inbuf
CLOSE #fnr
END IF
gtk_text_buffer_insert (buffer, @iter, inbuf, -1)
gtk_widget_show (win)
gtk_main ()
Last edited by TJF on Feb 01, 2014 15:53, edited 1 time in total.
Re: Copy and Paste Text
Thanks very much.
Will investigate.
Will investigate.
Re: Copy and Paste Text
Sorry no luck
In realizing it must need numerous files in folder GTk-d I ran the code in there.
But it sill invoked numerous errors asking below
Command executed:
"C:\Tools\FreeBASIC-0.90.1-win32\fbc.exe" "C:\Tools\FreeBASIC-0.90.1-win32\Gtk-3\t.bas"
Compiler output:
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgtk-3
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgdk-3
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgthread-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lglib-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgio-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgobject-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgmodule-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lpango-1.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lcairo
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgdk_pixbuf-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lpangocairo-1.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -latk-1.0
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 0.90.1 (07-17-2013) for win32
OS: Windows NT 6.1 (build 7601, Service Pack 1)
In realizing it must need numerous files in folder GTk-d I ran the code in there.
But it sill invoked numerous errors asking below
Command executed:
"C:\Tools\FreeBASIC-0.90.1-win32\fbc.exe" "C:\Tools\FreeBASIC-0.90.1-win32\Gtk-3\t.bas"
Compiler output:
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgtk-3
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgdk-3
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgthread-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lglib-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgio-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgobject-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgmodule-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lpango-1.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lcairo
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lgdk_pixbuf-2.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -lpangocairo-1.0
C:\Tools\FreeBASIC-0.90.1-win32\bin\win32\ld.exe: cannot find -latk-1.0
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 0.90.1 (07-17-2013) for win32
OS: Windows NT 6.1 (build 7601, Service Pack 1)
Re: Copy and Paste Text
Perhaps see at:
FBC Compile errors with GTK
FBC Compile errors with GTK