|
|
|||||||
[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
|
||||||||
|
|
|||||||
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: |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Arend, what Kixforms Version do you have in use? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
You used: Code: $tx.mulitline = True I use: Code: $tx.multiline = 1 |
||||||||
|
|
|||||||
Mulit line.... HA! Business in the front and party in the back. |
||||||||
|
|
|||||||
Hahaha Mullet :-) |
||||||||
|
|
|||||||
dammit y'all that's whatcha git from ain't using y'own editar k, let's hear Andre what the problem is |
||||||||
|
|
|||||||
[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 |
||||||||
|
|
|||||||
Works fine here. What is it exactly that does not work for you? |
||||||||
|
|
|||||||
[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!! [PtBr] Espero que consigam um algorítimo que funcione com ritchtextbox, seria muito útil para mim, obrigado desde já!! |