CNTRL C and V with a StringGadget

Windows specific forum
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

CNTRL C and V with a StringGadget

Post by RichardL »

I have several StringGadgets in a dialog and I would like the user to be able to highlight all or part of a string then CNTRL C to copy it and CNTRL V to paste it.

I find that Copy does not work... is there a flag that can be set to make it do so?

Thanks in advance...
Sub-Routine
User
User
Posts: 82
Joined: Tue May 03, 2005 2:51 am
Location: Wheeling, Illinois, USA
Contact:

Post by Sub-Routine »

Um, no problem here. I routinely copy and paste with String Gadgets.

PB 3.93, XP Pro SP 2.

Rand
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post by utopiomania »

Same here (=it works), except Ctrl-A doesn't highlight all.
RichardL
Enthusiast
Enthusiast
Posts: 532
Joined: Sat Sep 11, 2004 11:54 am
Location: UK

Post by RichardL »

OK, I've found out what does it...

Code: Select all

Version$="Test only..."

If OpenWindow(0,10,10,300,200,#PB_Window_MinimizeGadget,Version$)
  If CreateGadgetList(WindowID())
    Frame3DGadget(1,5,5,290,100,"Test")
    StringGadget (2,10,30,280,25,"Number 1",#PB_String_UpperCase)
    StringGadget (3,10,70,280,25,"Number 2",#PB_String_UpperCase)
  EndIf
  
  hMenu.l = CreateMenu(0, WindowID())
  If hMenu.l
    MenuTitle("File")
    MenuBar()
    MenuItem(19,"Beeps")
  EndIf
  
  ; Main display HOT KEYS
  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_P    ,500)
  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_C    ,501)
  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_S    ,502)
  AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_Home ,503)
 
EndIf

Quit =0
Repeat
  EventID.l = WaitWindowEvent()
  If EventID = #PB_Event_CloseWindow 
    Quit = 1
  EndIf
Until Quit = 1
If you disable the hot key shortcuts then it all works OK... with the shortcuts added the copy function fails and paste puts in stuff from earlier operations.

However, if hot key CNTRL C is disabled all is well... I guess thats reasonable! :oops: :oops:
Fred
Administrator
Administrator
Posts: 18357
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, you will have to handle the shortcut yourself if you redefine it (GetGadgetText() + SetClipboardText()).
Post Reply