Page 1 of 1 1
Topic Options
#212950 - 2017-11-24 01:54 PM TextBox[HELP]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 77
Loc: Brasil, João pessoa
[PtBr]
Olá a todos, eu gostaria de saber como faço para saber onde o cursor de digitação está dentro do texto como um todo.

[Eng]
Hello everyone, I would like to know how do I know where the typing cursor is inside the text as a whole.

 PHP:
break on $sys = createObject('kixtart.system') $frm = $sys.form() $frm.size = 450, 400 $tx = $frm.textbox $tx.dock = 5 $tx.text = 'ola1'+@crlf+'ola2'+@crlf+'ola3'+@crlf $frm.show while $frm.visible $=Execute($frm.doevents(1)) sleep 0.05 $ln = ubound(Split($tx.text, @crlf))+1 $lns = ubound(Split(substr($tx.text, 1, $tx.SelectionStart+1), @crlf))+1 $tx.SelectionStart-1? Len($tx.text)-$ln? $ln? $frm.text = "Length:"+Cstr(Len($tx.text))+ " | Lines:"+cstr($ln)+ " | Pos:"+Cstr($tx.SelectionStart+1)+ " | Line pos:"+cstr($lns) $lns = 0 $text = '' loop

Top
#213001 - 2017-11-27 01:38 PM Re: TextBox[HELP] [Re: AndreLuiz]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6374
Loc: Stuttgart, Germany
Ola Andre,

tested your demo script and Pos: in the Forms title already shows the position for me ...
What is odd and maybe a bug is that even if I add those 2 lines in the constructor section

 Code:
$tx.mulitline = True
$tx.WordWrap = True


the text is still displayed in one line having 2 non-displayed chacters for cr and lf.
Can someone verify this?

currently using kf 2.47.5.0 on Windows 7 Enterprise with KiXtart 4.67

here a screenshot:


Attachments
373.png
Description:


_________________________



Top
#213002 - 2017-11-27 02:03 PM Re: TextBox[HELP] [Re: Jochen]
Arend_ Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
 Code:
$tx.multiline = 1

Works for me.

 Code:
break on

$sys    = createObject('kixtart.system')
$frm    = $sys.form()

$frm.size = 450, 400
$tx = $frm.textbox
$tx.dock = 5
$tx.multiline = 1
$tx.text = 'ola1'+@crlf+'ola2'+@crlf+'ola3'+@crlf

$frm.show
while $frm.visible
    $=Execute($frm.doevents(1))
    sleep 0.05
    $ln = ubound(Split($tx.text, @crlf))+1
    $lns = ubound(Split(substr($tx.text, 1, $tx.SelectionStart+1), @crlf))+1
    $tx.SelectionStart-1?
    Len($tx.text)-$ln?
    $ln?
    $frm.text =
    "Length:"+Cstr(Len($tx.text))+
    " | Lines:"+cstr($ln)+
    " | Pos:"+Cstr($tx.SelectionStart+1)+
    " | Line pos:"+cstr($lns)
    $lns = 0
    $text = ''
loop

Top
#213004 - 2017-11-27 02:41 PM Re: TextBox[HELP] [Re: Arend_]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6374
Loc: Stuttgart, Germany
Arend,
what Kixforms Version do you have in use?
_________________________



Top
#213005 - 2017-11-27 03:50 PM Re: TextBox[HELP] [Re: Jochen]
Arend_ Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
 Originally Posted By: Jochen
Arend,
what Kixforms Version do you have in use?


Tested a patched version of 2.47.5 and now using 2.47.6.
I think you made a typo in "multiline"
You typed "mulitline"
Test the code I pasted.

Top
#213006 - 2017-11-27 03:53 PM Re: TextBox[HELP] [Re: Arend_]
Arend_ Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
You used:
 Code:
$tx.mulitline = True


I use:
 Code:
$tx.multiline = 1

Top
#213008 - 2017-11-27 04:25 PM Re: TextBox[HELP] [Re: Arend_]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4482
Loc: USA
Mulit line.... HA! Business in the front and party in the back. \:\)
Top
#213009 - 2017-11-27 04:28 PM Re: TextBox[HELP] [Re: Allen]
Arend_ Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
Hahaha Mullet :-)
Top
#213013 - 2017-11-27 07:20 PM Re: TextBox[HELP] [Re: Arend_]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6374
Loc: Stuttgart, Germany
dammit y'all that's whatcha git from ain't using y'own editar

k, let's hear Andre what the problem is ;\)
_________________________



Top
#213025 - 2017-11-29 05:02 AM Re: TextBox[HELP] [Re: Jochen]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 77
Loc: Brasil, João pessoa
[PtBr]
Muito obrigado pela ajuda!!!
hahahh, funcionou no textbox, mas no richtextbox não funciona, veja.

[Eng]
Thanks a lot for the help!!!
hahahh, it ran in the textbox, but the richtextbox does not work, see.

 Code:
break on

$sys    = createObject('kixtart.system')
$frm    = $sys.form()

$frm.size = 450, 400
$tx = $frm.Richtextbox
$tx.dock = 5
$tx.multiline = 1
$tx.text = 'ola1'+@crlf+'ola2'+@crlf+'ola3'+@crlf

$frm.show
while $frm.visible
    $=Execute($frm.doevents(1))
    sleep 0.05
    $ln = ubound(Split($tx.text, @crlf))+1
    $lns = ubound(Split(substr($tx.text, 1, $tx.SelectionStart+1), @crlf))+1
    $tx.SelectionStart-1?
    Len($tx.text)-$ln?
    $ln?
    $frm.text =
    "Length:"+Cstr(Len($tx.text))+
    " | Lines:"+cstr($ln)+
    " | Pos:"+Cstr($tx.SelectionStart+1)+
    " | Line pos:"+cstr($lns)
    $lns = 0
    $text = ''
loop

Top
#213026 - 2017-11-29 11:30 AM Re: TextBox[HELP] [Re: AndreLuiz]
Arend_ Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1870
Loc: Hilversum, The Netherlands
Works fine here.
What is it exactly that does not work for you?

Top
#213075 - 2017-12-15 01:33 PM Re: TextBox[HELP] [Re: Arend_]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 77
Loc: Brasil, João pessoa
[Eng(Translate)]
Hello, pardon me for the delay.
The error is displayed automatically by an image, notice a column where it is and tell what it should actually have there.

[PtBr]
Olá perdoe-me pela demora.
O erro estará autoexplicativo ao ver a imagem, repare a coluna onde está e conte o que deveria ter ali de fato.



[Eng(Translate)]
I hope they get an algorithm that works with richtextbox, it would be very useful for me, thank you in advance!! \:D

[PtBr]
Espero que consigam um algorítimo que funcione com ritchtextbox, seria muito útil para mim, obrigado desde já!! \:D

Top
Page 1 of 1 1


Moderator:  ShaneEP, Mart, Radimus, Jochen, Allen, Glenn Barnas 
Hop to:
Shout Box

Who's Online
0 registered and 167 anonymous users online.
Newest Members
KatieQuinn, Brennnnn, MKubicsek, xguixa, mdress
17681 Registered Users

Generated in 0.039 seconds in which 0.011 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org