RE: Ready Only MLE

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bingo, I want the MLE to be display only, but I still want to be able to 
scroll, and copy from it.

I have solved this though, thank you.
What I had to do was make an event handler for onEvent, and trap the 
LeftDown, LeftUp and RightDown events. The LeftDown event sets a toggle 
which allows copying selections from the MLE. The other two unset the 
toggle and setFocus to the default control.

I made another event handler for KeyDown to trap ctrl-C when the  toggle 
is true.

Here is my code snippet for the archives, if anyone is interested.

< CODE >
integer WM_MLE_Main_editable  WM_MLE_Main_editable=0
procedure WM_MLE_Main_onEvent(integer event, atom wParam, atom lParam)
   if event = LeftDown then   
      WM_MLE_Main_editable=1
   elsif event = LeftUp or event = RightDown then
      WM_MLE_Main_editable=0
      setFocus(WM_MLE_Edit)
   end if
end procedure
onEvent[WM_MLE_Main] = routine_id("WM_MLE_Main_onEvent")

procedure WM_MLE_Main_onKeyDown(integer keycode, integer sflag)
   if WM_MLE_Main_editable then
      if and_bits(sflag,ControlMask) then
         if keycode = 'C' then copy(WM_MLE_Main) end if
      end if
   end if
end procedure
onKeyDown[WM_MLE_Main] = routine_id("WM_MLE_Main_onKeyDown")
< END OF CODE >

Chris


Thomas Parslow (PatRat) wrote:
> > Another Q...
> 
> >    I know how to make the MLE read_only, and non-TABable, but but the 
> > MLE can still be selected with the mouse. Focus is then given to the 
> > MLE, and it displays the caret position. I don't want the MLE to be able 
> > 
> > to receive focus at all.
> 
> >   I've tried trapping onGotFocus, and setting the focus to the default 
> > ctrl, but it doesn't work. In fact, as a result of setting the focus to 
> > the default ctrl, I'm not able to select that control anymore.
> 
> >   I've also tried trapping the onMouse event, and Left button events 
> > aren't reported to the handler. And even so, I'm still not able to set 
> > the focus to the other ctrl.
> 
> > TIA
> > Chris
> 
> Wouldn't a LText control be better here or did you want the user
> to still be able to copy text from it?
> 
> Thomas Parslow (PatRat) ICQ #:26359483
> Rat Software
> http://www.rat-software.com/
> Please leave quoted text in place when replying
> 
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu