Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10283 > unrolled thread

Cursor position in a short SingleLineEdit

Started byzodcomag@gmail.com
First post2017-03-13 05:49 -0700
Last post2017-03-15 03:51 -0700
Articles 6 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Cursor position in a short SingleLineEdit zodcomag@gmail.com - 2017-03-13 05:49 -0700
    Re: Cursor position in a short SingleLineEdit Franz Rachbauer <office@rachbauer.org> - 2017-03-13 18:44 +0100
    Re: Cursor position in a short SingleLineEdit "Jamal" <noooospam@example.com> - 2017-03-13 13:50 -0400
    Re: Cursor position in a short SingleLineEdit zodcomag@gmail.com - 2017-03-14 11:44 -0700
    Re: Cursor position in a short SingleLineEdit "Karl-Heinz" <invalid@invalid.invalid> - 2017-03-15 08:01 +0100
    Re: Cursor position in a short SingleLineEdit zodcomag@gmail.com - 2017-03-15 03:51 -0700

#10283 — Cursor position in a short SingleLineEdit

Fromzodcomag@gmail.com
Date2017-03-13 05:49 -0700
SubjectCursor position in a short SingleLineEdit
Message-ID<91b5b94f-c406-4699-be07-8ee2988a7e0a@googlegroups.com>
The text in the SLE is longer then the control itself.

When entering and exiting the SLE, the cursor is at the end of the text, the text is scrolled, which means that the start of the text is not seen.

I want to change the behaviour.

For exiting the SLE, I put in the EditFocusChane:
   if IsInstanceOf(oControl, #SingleLineEdit)
      oSLE := oControl
      oSLE:__CurPos := 1       // __CurPos is not a Control method
   endif

It does work if lGotFocus = .F. (exiting the control),
but not entering the control (lGotFocus = .T.)

Any idea how can I enter the control so the cursor is in the beginnig of the text, and the text does not scroll?

Thanks
Henry

[toc] | [next] | [standalone]


#10285

FromFranz Rachbauer <office@rachbauer.org>
Date2017-03-13 18:44 +0100
Message-ID<oa6lqr$b2s$1@gioia.aioe.org>
In reply to#10283
Henry,
oDCsleField:FocusSelect := FSEL_HOME
oDCsleField:SetFocus()
sets cursor at the beginning and nothing selected.

Regards, Franz

Am 13.03.2017 um 13:49 schrieb zodcomag@gmail.com:
> The text in the SLE is longer then the control itself.
>
> When entering and exiting the SLE, the cursor is at the end of the text, the text is scrolled, which means that the start of the text is not seen.
>
> I want to change the behaviour.
>
> For exiting the SLE, I put in the EditFocusChane:
>    if IsInstanceOf(oControl, #SingleLineEdit)
>       oSLE := oControl
>       oSLE:__CurPos := 1       // __CurPos is not a Control method
>    endif
>
> It does work if lGotFocus = .F. (exiting the control),
> but not entering the control (lGotFocus = .T.)
>
> Any idea how can I enter the control so the cursor is in the beginnig of the text, and the text does not scroll?
>
> Thanks
> Henry
>
>

[toc] | [prev] | [next] | [standalone]


#10286

From"Jamal" <noooospam@example.com>
Date2017-03-13 13:50 -0400
Message-ID<oa6m5c$jnp$1@news.albasani.net>
In reply to#10283
Simple!

Change the Focus Select property in the General tab of the Single Line Edit 
to FSEL_HOME. Remove your EditFocusChange code.

I suggest you check the documentation for this and other options.

Jamal

wrote in message 
news:91b5b94f-c406-4699-be07-8ee2988a7e0a@googlegroups.com...

The text in the SLE is longer then the control itself.

When entering and exiting the SLE, the cursor is at the end of the text, the 
text is scrolled, which means that the start of the text is not seen.

I want to change the behaviour.

For exiting the SLE, I put in the EditFocusChane:
   if IsInstanceOf(oControl, #SingleLineEdit)
      oSLE := oControl
      oSLE:__CurPos := 1       // __CurPos is not a Control method
   endif

It does work if lGotFocus = .F. (exiting the control),
but not entering the control (lGotFocus = .T.)

Any idea how can I enter the control so the cursor is in the beginnig of the 
text, and the text does not scroll?

Thanks
Henry

[toc] | [prev] | [next] | [standalone]


#10289

Fromzodcomag@gmail.com
Date2017-03-14 11:44 -0700
Message-ID<8b18ea22-f598-433a-8984-3cf7d802cdbe@googlegroups.com>
In reply to#10283
Franz & Jamal thanks
But it does not work for me:

1. I put in the PostInit() the following code:
   a_Controls := self:GetAllChildren()
   nLen := ALen(a_Controls)
	
   for i := 1 upto nLen
      if IsInstanceOf(a_Controls[i], #SingleLineEdit)
         a_Controls[i]:FocusSelect := FSEL_HOME
      endif
   next

it did not work, so I tried the other aaproch, in the EditFocusChange()

2. if IsInstanceOf(oControl, #SingleLineEdit)
      oSLE := oControl	
      oSLE:FocusSelect := FSEL_HOME
      oSLE:SetFocus()
   endif

It also does not work, and entering into the SLE, the cursor is in the end of the TextValue, so the beginning is not seen.

[toc] | [prev] | [next] | [standalone]


#10290

From"Karl-Heinz" <invalid@invalid.invalid>
Date2017-03-15 08:01 +0100
Message-ID<eis76qFp8o2U2@mid.individual.net>
In reply to#10283
Hi Henry,

>
> The text in the SLE is longer then the control itself.
>

i gave it a try using a modified EditFocusChange(). No matter if the sle 
gains or looses the focus, the start of the text is now visible.


METHOD EditFocusChange(oEditFocusChangeEvent) CLASS DlgTest
    LOCAL oControl AS Control
    LOCAL lGotFocus AS LOGIC
    oControl := IIF(oEditFocusChangeEvent == NULL_OBJECT, NULL_OBJECT,
oEditFocusChangeEvent:Control)
    lGotFocus := IIF(oEditFocusChangeEvent == NULL_OBJECT, FALSE,
oEditFocusChangeEvent:GotFocus)
    SUPER:EditFocusChange(oEditFocusChangeEvent)
    //Put your changes here

    IF IsInstanceOf ( oControl , #singleLineEdit )

            PostMessage ( oControl:Handle() , EM_setsel , 0 , 0L)

    ENDIF


    RETURN NIL


regards
Karl-Heinz 

[toc] | [prev] | [next] | [standalone]


#10293

Fromzodcomag@gmail.com
Date2017-03-15 03:51 -0700
Message-ID<f62e46f4-d5ed-4f0a-98a7-2aea93e12911@googlegroups.com>
In reply to#10283
Karl-Heinz

Danke, it does solve the problem.

Henry

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web