Select text to string

Linux specific forum
User avatar
microdevweb
Enthusiast
Enthusiast
Posts: 179
Joined: Fri Jun 13, 2014 9:38 am
Location: Belgique

Select text to string

Post by microdevweb »

Hello everybody,

Can you tell me wen can select a texte from StringGadget with Linux

The equivalent to windows

Code: Select all

; Get the string selected
SendMessage_(GadgetID(Gadget),#EM_GETSEL,@PosStart,@PosEnd)
; Select the string to gadget
SendMessage_(GadgetID(Gadget),#EM_SETSEL,PosStart,PosEnd)
Before thanks
Use Pb 5.73 lst and Windows 10

my mother-language isn't english, in advance excuse my mistakes.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Select text to string

Post by Keya »

good question, handy to know! my google lead me to http://stackoverflow.com/questions/1033 ... n-gtkentry which suggests the gtk api gtk_editable_select_region(), and a google purebasic search for that shows it's only been used once! here (also has Mac solution) :) - http://www.purebasic.fr/english/viewtopic.php?p=394987 credit to Kukulkan :)

also related you can use SetActiveGadget(#ctrl) on all three OS to set not the selection but the focus on the textbox, which might be useful in combination :)
Last edited by Keya on Sat Oct 10, 2015 10:27 am, edited 1 time in total.
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Select text to string

Post by Oma »

Hello Keya and microdevweb.

A link with a little PB demo is here ...
http://www.chabba.de/Linux/StringGadget ... nctions.pb

I think it's no problem to extract the required part for partially selection in StringGadget.

Regards, Charly

PS:
A simple string end position = -1
Last edited by Oma on Sat Oct 10, 2015 10:28 am, edited 1 time in total.
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Select text to string

Post by Keya »

Oma im embarrassed! :oops: I only googled with site:purebasic.fr, i should've known you might've already covered it by now heehee :) :) :)
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Select text to string

Post by Oma »

Hi Keya,

I think i'll do a little promotion when PB releases the 5.40 and my library updates are done :wink:

Bye
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: Select text to string

Post by Vera »

Hi, I think I have already answered half of the request on the french forum last night but microdevweb replied that he doesn't test code that works on Linux.

so why ask for it ?

@Oma
I exactly shared that example of yours :D


@Admins/Mods:this thread is in the wrong forum - likely by accident
User avatar
microdevweb
Enthusiast
Enthusiast
Posts: 179
Joined: Fri Jun 13, 2014 9:38 am
Location: Belgique

Re: Select text to string

Post by microdevweb »

Thank's for your answers. But i look it's not easy for me but my computer it's on Windows. So i don't convert my RAD code in mulit os, pity i leave this Windows only.
Use Pb 5.73 lst and Windows 10

my mother-language isn't english, in advance excuse my mistakes.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Select text to string

Post by Keya »

now im confused! your OP asked for code that runs on Linux, which you now have... but now you're saying you only use Windows so aren't interested in testing the linux code?
if it's just because you dont have Linux installed and maybe havent used it before dont worry, i hadnt either until a few months ago! but you can download Virtualbox for free, and Linux is also a free download (i use Linux Mint as its apparently one of the friendlier ones to use!), so it's easy to do all your Linux testing and development in a VM :) If I can anyone can, lol
User avatar
microdevweb
Enthusiast
Enthusiast
Posts: 179
Joined: Fri Jun 13, 2014 9:38 am
Location: Belgique

Re: Select text to string

Post by microdevweb »

Thank's Kena for your advises, I'm going to try your soluce.

Notice to moderators sorry I see that I posted in the wrong place
Use Pb 5.73 lst and Windows 10

my mother-language isn't english, in advance excuse my mistakes.
Post Reply