Page 1 of 1
CNTRL C and V with a StringGadget
Posted: Mon Aug 08, 2005 11:30 am
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...
Posted: Mon Aug 08, 2005 9:59 pm
by Sub-Routine
Um, no problem here. I routinely copy and paste with String Gadgets.
PB 3.93, XP Pro SP 2.
Rand
Posted: Mon Aug 08, 2005 10:31 pm
by utopiomania
Same here (=it works), except Ctrl-A doesn't highlight all.
Posted: Tue Aug 09, 2005 12:38 pm
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!

Posted: Tue Aug 09, 2005 10:31 pm
by Fred
Yes, you will have to handle the shortcut yourself if you redefine it (GetGadgetText() + SetClipboardText()).