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


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

Selection in MulitlineEdit

Started byLu <lu2k@hotmail.com>
First post2015-11-09 07:01 -0800
Last post2015-11-13 13:19 +0100
Articles 2 — 2 participants

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


Contents

  Selection in MulitlineEdit Lu <lu2k@hotmail.com> - 2015-11-09 07:01 -0800
    Re: Selection in MulitlineEdit "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2015-11-13 13:19 +0100

#8626 — Selection in MulitlineEdit

FromLu <lu2k@hotmail.com>
Date2015-11-09 07:01 -0800
SubjectSelection in MulitlineEdit
Message-ID<61e47ada-ce37-4c70-8360-c9fcc8d6519e@googlegroups.com>
Hi VO-Experts

There is a multiline-edit control with readonly and with doubleclick I can change the content of the mle. When I make a doubleclick on the mle the courser should stay in a new line and nothing should be selected. 

At the first doubleclick the readonly flag is getting false and I can edit the content, but there is always a selection of a word or more. There should nothing be selected. At the second time I make a doubleclick the courser jumps to a new line and everything works fine.

METHOD EventHandler(oEvent) CLASS Tab1

If oEvent:Message = WM_LBUTTONDBLCLK
  If oEvent:Window = self:oDCmleTest
    self:oDCmleTest:ReadOnly := false

   self:oDCmleTEst:VALUE := self:oDCmleTEst:VALUE + _chr(10)		                           
   nLen := SLen(self:oDCmleTEst:VALUE)   
   self:oDCmleTEst:Selection := Selection{nLen,nLen} 

   PostMessage(self:oDCmleTEst:Handle(), EM_SCROLLCARET, nLen, nLen) 
   PostMessage(self:oDCmleTEst:Handle(), EM_SETSEL,nLen,nLen)
   self:oDCmleTEst:PageDown()   

  ENDIF
ENDIF

I also tried an extra Dispatch Method for the mle or a new Setfocus() Method, for no selection but at the first doubleclick it does not help. I also tried it in the EditFocusChange Method

Method Dispatch(oEvent) class mleStandard1
  IF oEvent:Message == WM_LBUTTONDBLCLK
    IF  GetFocus() == self:Handle()
       PostMessage(self:Handle(), EM_SETSEL,0,0) 
       PostMessage(self:Handle(), EM_SCROLLCARET, 0, 0)
    ENDIF
  ENDIF

RETURN SUPER:Dispatch(oEvent)

Method SetFocus() class mleStandard1
  self:Selection:=Selection{Len(self:VALUE),Len(self:VALUE)} 
  PostMessage(self:Handle(), EM_SCROLLCARET, 0, 0)
Return Nil

method EditFocusChange(oEditFocusChangeEvent) class Tab1   
  LOCAL dwLen1 as DWORD 
  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)
   
  IF lGotFocus == true
   IF oControl:NameSym == #mleTest 
     dwLen1 := SLen(self:oDCmleTEst:TEXTValue)
PostMessage(oEditFocusChangeEvent:Control:Handle(), EM_SETSEL, dwLen1, dwLen1)
PostMessage(oEditFocusChangeEvent:Control:Handle(), EM_SCROLLCARET, 0, 0)
   ENDIF
  ENDIF

Thanks for any help in advance
Lu






[toc] | [next] | [standalone]


#8666

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2015-11-13 13:19 +0100
Message-ID<dam3k0Fcbj1U1@mid.individual.net>
In reply to#8626
Hi Lu,

Please check your mail...
regards
Urs

"Lu" <lu2k@hotmail.com> schrieb im Newsbeitrag 
news:61e47ada-ce37-4c70-8360-c9fcc8d6519e@googlegroups.com...
Hi VO-Experts

There is a multiline-edit control with readonly and with doubleclick I can 
change the content of the mle. When I make a doubleclick on the mle the 
courser should stay in a new line and nothing should be selected.

At the first doubleclick the readonly flag is getting false and I can edit 
the content, but there is always a selection of a word or more. There should 
nothing be selected. At the second time I make a doubleclick the courser 
jumps to a new line and everything works fine.

METHOD EventHandler(oEvent) CLASS Tab1

If oEvent:Message = WM_LBUTTONDBLCLK
  If oEvent:Window = self:oDCmleTest
    self:oDCmleTest:ReadOnly := false

   self:oDCmleTEst:VALUE := self:oDCmleTEst:VALUE + _chr(10)
   nLen := SLen(self:oDCmleTEst:VALUE)
   self:oDCmleTEst:Selection := Selection{nLen,nLen}

   PostMessage(self:oDCmleTEst:Handle(), EM_SCROLLCARET, nLen, nLen)
   PostMessage(self:oDCmleTEst:Handle(), EM_SETSEL,nLen,nLen)
   self:oDCmleTEst:PageDown()

  ENDIF
ENDIF

I also tried an extra Dispatch Method for the mle or a new Setfocus() 
Method, for no selection but at the first doubleclick it does not help. I 
also tried it in the EditFocusChange Method

Method Dispatch(oEvent) class mleStandard1
  IF oEvent:Message == WM_LBUTTONDBLCLK
    IF  GetFocus() == self:Handle()
       PostMessage(self:Handle(), EM_SETSEL,0,0)
       PostMessage(self:Handle(), EM_SCROLLCARET, 0, 0)
    ENDIF
  ENDIF

RETURN SUPER:Dispatch(oEvent)

Method SetFocus() class mleStandard1
  self:Selection:=Selection{Len(self:VALUE),Len(self:VALUE)}
  PostMessage(self:Handle(), EM_SCROLLCARET, 0, 0)
Return Nil

method EditFocusChange(oEditFocusChangeEvent) class Tab1
  LOCAL dwLen1 as DWORD
  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)

  IF lGotFocus == true
   IF oControl:NameSym == #mleTest
     dwLen1 := SLen(self:oDCmleTEst:TEXTValue)
PostMessage(oEditFocusChangeEvent:Control:Handle(), EM_SETSEL, dwLen1, 
dwLen1)
PostMessage(oEditFocusChangeEvent:Control:Handle(), EM_SCROLLCARET, 0, 0)
   ENDIF
  ENDIF

Thanks for any help in advance
Lu






[toc] | [prev] | [standalone]


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


csiph-web