Page 1 of 1

Select text to string

Posted: Sat Oct 10, 2015 9:43 am
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

Re: Select text to string

Posted: Sat Oct 10, 2015 10:21 am
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 :)

Re: Select text to string

Posted: Sat Oct 10, 2015 10:27 am
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

Re: Select text to string

Posted: Sat Oct 10, 2015 10:28 am
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 :) :) :)

Re: Select text to string

Posted: Sat Oct 10, 2015 10:33 am
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

Re: Select text to string

Posted: Sat Oct 10, 2015 10:34 am
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

Re: Select text to string

Posted: Sat Oct 10, 2015 11:12 am
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.

Re: Select text to string

Posted: Sat Oct 10, 2015 11:26 am
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

Re: Select text to string

Posted: Sat Oct 10, 2015 11:50 am
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