` Printed Icetips Article

Icetips Article



Clarion in general: Adding Copy - Cut - Paste to entry fields
2004-07-20 -- Robert Peros
 
Newsgroups: softvelocity.clarion.language,softvelocity.public.clarion5x


> > 2. Alert the right mouse and construct your own popup for the entry
> > controls.
> Is it possible? Popup is, of course. But copy/paste functionality isn't (i
> could not do it ;^)

It's easy.Something like that in: WM.Init after all
0{PROP:Alrt,100}  = MouseRightUp  != WindowComponent.SetAlerts
or ALERT(MouseRightUp) +
       NEW(Popup)
        ....
       Popup.AddItem('-',Q.First,1,1)
       Popup.AddMenu(Q.Menu,PC.GetItems() + 1)     !Menu 1
       Popup.AddItem('Cut(spremi i brisi)' ,Q.First+1,2,Q.Level)!1
        IF ~CLIPBOARD()                            !Nema pogodnog formata
        Popup.SetItemEnable(Q.First+4,False)       !Disable Paste Funkciju
        ...

In WM.Kill                                         !=WindowComponent.Kill
......
DISPOSE(Popup)

In WM.TakeEvent                               !=WindowComponent.TakeEvent
    CASE EVENT()
       OF EVENT:AlertKey
             IF KEYCODE(MouseRightUp)
                  .....Exec(PopupClass.Ask()) / POPUP
                  RETURN Level:Notify  for eg. /

!x Pop_Clipboard.Pop_Exec.Exec         PROCEDURE(USHORT LastSelection..
 CODE
STRING
    CASE LastSelection
         OF Q.First + 1                           !CUT    = CtrlX
            SETCLIPBOARD(FOCUS(){PROP:ScreenText})
            FOCUS(){PROP:ScreenText} = ''
         OF Q.First + 2                           !COPY   = CtrlC
            SETCLIPBOARD(FOCUS(){PROP:ScreenText})
         OF Q.First + 3                           !None
            SETCLIPBOARD(CLIPBOARD() & ',' & FOCUS(){PROP:ScreenText})
         OF Q.First + 4                           !PASTE  = CtrlV
            FOCUS(){PROP:ScreenText} = CLIPBOARD()
         OF Q.First + 5                           !DELETE = CtrlDel
            FOCUS(){PROP:ScreenText} = ''
    END
!x RETURN NULL                                    !NEMA Pop_Next Interface.

Again ,create class with WindowComponent and in win.init
run SELF.AddItem(MyDummyClass.WindowComponent)
and forget about this.WM take care about rest (call,kill...)

R.



Printed November 21, 2024, 6:31 am
This article has been viewed/printed 35240 times.
Google search has resulted in 63 hits on this article since January 25, 2004.