Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shortcut menu on EditBox
Message
 
 
To
25/01/2002 11:58:56
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00610274
Message ID:
00610599
Views:
49
>>>>>Type, report etc.
>>>>>Cetin
>>>>
>>>>Hi Cetin,
>>>>
>>>>Is there a way to make File/Print button menu operates on EditBox content? I don't want to write a special program, I want to use native ability to print. However, it doesn't seem to work with editboxes...
>>>
>>>Type, report are native to VFP.
>>>Cetin
>>
>>Type operates on file's content. So, from the menu point of view we need to find out currently active window, output its content to temp file and then use this command...
>
>Nadya,
>Not a big deal to find out the content.
>
*Rightclick
>do myshcut.mpr with this
>
>*myshcut.mpr
>lparameters toObject
>DEFINE POPUP shortcut SHORTCUT RELATIVE FROM MROW(),MCOL()
>DEFINE BAR _med_cut OF shortcut PROMPT "Cu\<t" ;
>	KEY CTRL+X, "Ctrl+X" ;
>	MESSAGE "Removes the selection and places it onto the Clipboard"
>DEFINE BAR _med_copy OF shortcut PROMPT "\<Copy" ;
>	KEY CTRL+C, "Ctrl+C" ;
>	MESSAGE "Copies the selection onto the Clipboard"
>DEFINE BAR _med_paste OF shortcut PROMPT "\<Paste" ;
>	KEY CTRL+V, "Ctrl+V" ;
>	MESSAGE "Pastes the contents of the Clipboard"
>DEFINE BAR _med_slcta OF shortcut PROMPT "Se\<lect All" ;
>	KEY CTRL+A, "Ctrl+A" ;
>	MESSAGE "Selects all text or items in the current window"
>DEFINE BAR 5 OF shortcut PROMPT "Print" ;
>	KEY CTRL+P, "Ctrl+P"
>On selection bar 5 of shortcut do Printme with toObject.Value
>
>ACTIVATE POPUP shortcut
>
>function printme
>lparameters tcPrint
>create cursor dummy (Edited m)
>insert into dummy values (tcPrint)
>report form dummy to printer
>use in 'dummy'
>
Don't forget to create the report dummy.
>Cetin

Thanks, Cetin. I'm writting something similar in the same time. I got not Enough memory message couple of times, but hopefully I'll make it work. Thanks again for your ideas.

BTW, for unknown reason now all items in the menu are enabled. Why it what? If I just run the menu from command window, some of the items are disabled. This is how it worked originally. However, now they don't work this way...

Hi Cetin again,

I finally made it work after several attempts. I used your first idea. Form's load: Create_Popup()
EditBox RightClick - activate popup Edit_Box at mrow(),mcol()
Form's destroy - Release popup Edit_Box
Create_Popup:
********************************************************************
*  Description.......: Create_Popup - creates shortcut menu for edit boxes
*  Calling Samples...: 
*  Parameter List....: tcPopupName, toForm
*  Created by........: Cetin Basoz 
*  Modified by.......: Nadya Nosonovsky 01/25/2002 10:30:05 AM
********************************************************************
lparameter tcPopupName, toForm
if vartype(m.tcPopupName)<>"C"
   tcPopupName = 'Edit_Box'
endif
DEFINE POPUP (m.tcPopupName) SHORTCUT RELATIVE
DEFINE BAR _med_undo OF (m.tcPopupName) PROMPT "\<Undo" ;
 KEY CTRL+Z, "Ctrl+Z" ;
 MESSAGE "Undoes the last command or action"
DEFINE BAR _med_redo OF (m.tcPopupName) PROMPT "Re\<do" ;
 KEY CTRL+R, "Ctrl+R" ;
 MESSAGE "Repeats the last command or action"
 
DEFINE BAR 3 OF (m.tcPopupName) PROMPT "\-" 
DEFINE BAR _med_cut OF (m.tcPopupName) PROMPT "Cu\<t" ;
 KEY CTRL+X, "Ctrl+X" ;
 MESSAGE "Removes the selection and places it onto the Clipboard"
DEFINE BAR _med_copy OF (m.tcPopupName) PROMPT "\<Copy" ;
 KEY CTRL+C, "Ctrl+C" ;
 MESSAGE "Copies the selection onto the Clipboard"
DEFINE BAR _med_paste OF (m.tcPopupName) PROMPT "\<Paste" ;
 KEY CTRL+V, "Ctrl+V" ;
 MESSAGE "Pastes the contents of the Clipboard"
DEFINE BAR _med_slcta OF (m.tcPopupName) PROMPT "Se\<lect All" ;
 KEY CTRL+A, "Ctrl+A" ;
 MESSAGE "Selects all text or items in the current window"   
DEFINE BAR 8 OF (m.tcPopupName) PROMPT "P\<rint content" ; && _mfi_sysprint
 KEY CTRL+P, "Ctrl+P" ;
 MESSAGE "Prints window's content"    
local lnBars, lcValue 
lnBars = cntbar('Edit_Box')
on selection bar m.lnBars of Edit_Box do PrintContent with _screen.ActiveForm.ActiveControl.Value
PrintContent:
********************************************************************
*  Description.......: PrintContent - prints EditBox content
*  Calling Samples...: 
*  Parameter List....: tcValue
*  Created by........: Nadya Nosonovsky 01/25/2002 12:33:03 PM 
*  Modified by.......: 
********************************************************************
lparameters tcValue
if vartype(m.tcValue)<>"C"
   tcValue = "Nadya's test"
endif
local lnSelect
lnSelect = select()
select 0
create cursor dummy (cMessage M, cTitle M)
append blank
replace dummy.cMessage with m.tcValue, cTitle with "Procedure's code"
report form Statistics to print prompt
use && Close dummy
select (m.lnSelect)
return
Thank you so much for the help.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform