Tab into text field, cursor goes to the end of the string

Started by Dwight Scoles, November 12, 2006, 06:02:53 PM

Previous topic - Next topic

Dwight Scoles

This is my first application in either PB or FireFly.  I have programmed a small amount in three other GUI environmants but have not created a lot of apps in this GUI world.  So, I may not understand what "normal" behavior I should expect from text boxes.

Here is the issue:

I read a DB (Tsunami) recod from a file and display it in fields on a screen after trimming each of the fields from the UDT structure.  

When I tab from one field containing data to the next field, the data in the new field is scrolled way to the left (if longer than the visible box) and the cursor is set at the position following the last character in the text box.  It is as though I held down the "right arrow" key after entering the text box.  This happens for multi-line and single-line text.  

In addition, if I tab into a text box that has more words than will fit (or more lines than in a multi-line box), then the text remains positioned to show the final words of the string when tabbing out of the field, even if I don't edit anything.  In other words, it does not "unscroll" to show the starting words in the string within the box when exiting the text box.

 (I have the same outcome on a W2K desktop and on my XP laptop)

1) Is this considered "normal" behavior for a WINDOWS text box?

2) Is there a way to force editing to start with the cursor positioned before the first character instead of after the final character when tabbing into a text box?

3) If #1 is YES and #2 is NO, is there any way, upon tabbing out of a text box, to force the string to scroll back to the original display showing the first words of the string instead of the last words of the string?

Thanks to anyone with pointers on this item.  The current behavior makes the application seem very unprofessional in my mind.  I may have a difficult time telling my client just to "live with it" so any help would be greatly appreciated.

Dwight

TechSupport

Hi Dwight,

Welcome to the FireFly world - I hope that I can help you along with your questions.

You can position the text cursor to anywhere within the text by using the FF_TextBox_SetSel function. Use that function whenever the textbox gets focus. For example:

Function FORM1_TEXT1_EN_SETFOCUS ( _
                                ControlIndex   As Long,  _  ' index in Control Array
                                hWndForm       As Dword, _  ' handle of Form
                                hWndControl    As Dword, _  ' handle of Control
                                idTextControl  As Long   _  ' identifier of text control
                                ) As Long

  FF_TextBox_SetSel hWndControl, 0, 0
 
End Function


The above code will position the text cursor at the start of the text and not highlight any of it.

Dwight Scoles

Thank you Paul.  That is exactly the command I needed!  And, your quickness in reply was more than I could hope for.