Cursor in an editor gadget

Linux specific forum
Armoured
Enthusiast
Enthusiast
Posts: 365
Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:

Cursor in an editor gadget

Post by Armoured »

Hi :)
Is possible to read and to set the position of the cursor in one editor gadget?
If yes how?





Thanks
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Reply deleted. Mine was Windows based :oops:
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Armoured
Enthusiast
Enthusiast
Posts: 365
Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:

Post by Armoured »

blueznl wrote:Reply deleted. Mine was Windows based :oops:
;)

To set the cursor position for Linux I have found this: http://www.purebasic.fr/english/viewtop ... ght=cursor

But to read the cursor position? :?
User avatar
dhouston
Enthusiast
Enthusiast
Posts: 430
Joined: Tue Aug 21, 2007 2:44 pm
Location: USA (Cincinnati)
Contact:

Post by dhouston »

Would you mind posting a working example? I tried the code in that post and it does not work for me.

Code: Select all

  IO = EditorGadget(#PB_Any, 6, 207, 540, 260 , #PB_Editor_ReadOnly)
   GadgetToolTip(IO, "Input/Output Window")
   ;remove from compiled version
   For k=0 To 50
     AddGadgetItem(IO, -1, "15:20:36 <T1 This is only an example n° "+Str(k))
   Next
  ;'does not work
  GadgetID = GadgetID(IO)
  length = gtk_text_get_length_(GadgetID)  ;returns 0
  gtk_editable_set_position_(GadgetID, length)  ;does nothing
Armoured
Enthusiast
Enthusiast
Posts: 365
Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:

Post by Armoured »

Hi
I'm sorry but my link is wrong for this type of gadget.
I think the solution is to use "gtk_text_buffer_place_cursor" but I need an example of code.
Armoured
Enthusiast
Enthusiast
Posts: 365
Joined: Mon Jan 26, 2004 11:39 am
Location: ITALY
Contact:

Post by Armoured »

I need help with this:

Code: Select all

     buffer = gtk_text_view_get_buffer_(GadgetID(#Gadget_Form1_Editor1))
     gtk_text_buffer_place_cursor_(buffer,?)
what is the second parameter of the "gtk_text_buffer_place_cursor"? :?
hardfalcon
User
User
Posts: 89
Joined: Fri Apr 29, 2005 3:03 pm
Location: Luxembourg
Contact:

Post by hardfalcon »

gtk_editable_get_position_() :?:
"And God caused a deep sleep to fall upon Adam, and he slept: and he took one of his ribs, and closed up the flesh instead thereof; And the spare rib, which God had taken from man, made he a woman, and brought her unto the man"
User avatar
dhouston
Enthusiast
Enthusiast
Posts: 430
Joined: Tue Aug 21, 2007 2:44 pm
Location: USA (Cincinnati)
Contact:

Post by dhouston »

Armoured wrote:what is the second parameter of the "gtk_text_buffer_place_cursor"? :?
It's a pointer so it should be the sum of the buffer pointer plus the length of the text but I do not know how to get the length of the text in the buffer.
Post Reply