Move programically the cursor to the end in the textbox?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Move programically the cursor to the end in the textbox?

Post by Czarny_Pijar »

How to move programically the cursor to the end in the textbox?
Borrowed from the Clipper

Code: Select all

Keyboard Chr(K_END)
seems to be useless.
The demo is attached below.
Attachments
txtbox.zip
(1.48 KiB) Downloaded 274 times
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Move programically the cursor to the end in the textbox?

Post by Roberto Lopez »

Czarny_Pijar wrote:How to move programically the cursor to the end in the textbox?
Borrowed from the Clipper

Code: Select all

Keyboard Chr(K_END)
seems to be useless.

The demo is attached below.
Keyboard is a console mode command. It does not work in GUI mode.

The same thing can be achieved in HMG using 'caretpos' property.

ie:

Win1.Text1.CaretPos := Len(Win1.Text1.Value)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Move programically the cursor to the end in the textbox?

Post by esgici »

Czarny_Pijar wrote:How to move programically the cursor to the end in the textbox?
Borrowed from the Clipper

Code: Select all

Keyboard Chr(K_END)
seems to be useless.
The demo is attached below.
Hi Czarny

You are right, not only Keyboard command, INKEY() and LASTKEY() functions too, not only useless, meaningless too in GUI mode.

Simply add

Code: Select all

  Main.Text_1.CaretPos := LEN( Main.Text_1.Value )
to the proc p_txt_chg()

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Move programically the cursor to the end in the textbox?

Post by Czarny_Pijar »

Tank you all, this works, but... We come back to the auto-trim inside the textbox problem discussed earlier here. Because of this, the new problem emerged:

How to programically add the space sign to the end of the string inside the textbox?

I suspect this is not possible, but... Let ours gurus confirm this. :)
PeteWG
Posts: 176
Joined: Sun Mar 21, 2010 5:45 pm

Re: Move programically the cursor to the end in the textbox?

Post by PeteWG »

Czarny_Pijar wrote:Tank you all, this works, but... We come back to the auto-trim inside the textbox problem discussed earlier here. Because of this, the new problem emerged:

How to programically add the space sign to the end of the string inside the textbox?

I suspect this is not possible, but... Let ours gurus confirm this. :)
I have no time right now to comment in detail, but (unless i have misunderstood your question) you may find what you are looking for into attached code.

---
Pete
Attachments
SMARTEND.7z
(1.59 KiB) Downloaded 267 times
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Move programically the cursor to the end in the textbox?

Post by Czarny_Pijar »

Thank you PeteWG for your code. I tried to use it, here's the stripped down version. Unfortunately it lost its functionality for no apparent (for me) reason. At this stage I see, only the predefined values of the strings can be SMART-ENDED :(
Attachments
SMARTEND.7z
(869 Bytes) Downloaded 265 times
bootwan
Posts: 52
Joined: Thu May 27, 2010 2:33 am

Re: Move programically the cursor to the end in the textbox?

Post by bootwan »

:cry:
Last edited by bootwan on Sat Jun 26, 2010 3:59 pm, edited 1 time in total.
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Move programically the cursor to the end in the textbox?

Post by Czarny_Pijar »

.
.
Yes, bootwan, that's exactly what I was looking for!
Works great, thank you very much :)
PeteWG
Posts: 176
Joined: Sun Mar 21, 2010 5:45 pm

Re: Move programically the cursor to the end in the textbox?

Post by PeteWG »

Czarny_Pijar wrote:Thank you PeteWG for your code. I tried to use it, here's the stripped down version. Unfortunately it lost its functionality for no apparent (for me) reason. At this stage I see, only the predefined values of the strings can be SMART-ENDED :(
You're right! And this "losing functionality" is probably due to some serious "feature" (or should i say bug?)
I'm not sure if it is a miniGHI problem or another one "achievement" of the usual suspect (MS).
Googling a bit, discovered that we are not alone in this, since Ms-Acces users have been complained also, for the very same textbox trim behavior.
Sadly, we have to live with it, since, as we are being told by various microsoft MVPs, "It is normal...."



---
Pete
Post Reply