Ivan Benttini
2008-11-13 05:29:14 UTC
Hello every one.
I have a form with a menu attached.
On the MENU
COPY_CUT_PASTE_UNDO works just right.
This form has also 4 buttons (COPY-CUT-PASTE-UNDO)
Copy, Cut, Paste also works just FINE, however the UNDO
does NOT.
Does any one knows why, since the 3 bottoms works OK?
It that something to do with the UNDO on the FORM, since on
the MENU it works OK?
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// Here is the code on the form
///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
this.rowset = this.employees1.rowset
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function BITMAPFIRST1_onOpen
form.employees1.rowset.first()
if form.employees1.rowset.endOfSet
form.employees1.rowset.first()
msgbox="You are at begining of file"
else
endif
return
function PUSHBUTTON1_onClick //copy
if type( "form.activeControl.copy" ) == "FP"
form.activeControl.copy()
form.PUSHBUTTON1.setfocus()
endif
return
function PUSHBUTTON2_onClick //cut
if type( "form.activeControl.cut" ) == "FP"
form.activeControl.cut()
form.PUSHBUTTON2.setfocus()
endif
return
function PUSHBUTTON3_onClick //paste
if type( "form.activeControl.paste" ) == "FP"
form.activeControl.paste()
form.PUSHBUTTON3.setfocus()
endif
return
function PUSHBUTTON4_onClick //UNDO .....HERE IS MY PROBLEM
FOR NOW.....
if type( "form.activeControl.undo" ) == "FP"
form.activeControl.undo()
form.PUSHBUTTON4.setfocus()
endif
return
function form_onOpen
this.root.EDITUNDOMENU:=this.root.EDIT.UNDO
this.root.EDITCOPYMENU:=this.root.EDIT.COPY
this.root.EDITCUTMENU:=this.root.EDIT.CUT
this.root.EDITPASTEMENU:=this.root.EDIT.PASTE
return
endclass
/////////////////////////////////////////////////////////////////////////////////////////////////
///// Here is also the code about the menu in the form ////////////////
///////////////////// 2nd class on the form
////////////////////////////////////////
Parameter FormObj,PopupName
NEW EDINFOPOPUP(FormObj,PopupName)
CLASS EDINFOPOPUP(FormObj,PopupName) OF POPUP(FormObj,PopupName)
this.Left = 0
this.Top = 0
this.TrackRight = .F.
this.Alignment = 1
this.OnInitMenu = CLASS::ROOT_ONINITMENU
DEFINE MENU COPY OF THIS;
PROPERTY;
Text "Copy",;
OnClick {; form.activeControl.Copy()}
DEFINE MENU PASTE OF THIS;
PROPERTY;
Text "Paste",;
OnClick {; form.activeControl.Paste()}
DEFINE MENU CUT OF THIS;
PROPERTY;
Text "Cut",;
OnClick {; form.activeControl.Cut()}
DEFINE MENU UNDO OF THIS;
PROPERTY;
Text "Undo",;
OnClick {; form.activeControl.Undo()} //<<<< this is the one not
working >>>> //////////
Procedure ROOT_OnInitMenu
control=form.activeControl
ctrl= control.className $ "ENTRYFIELD|EDITOR|BROWSE|GRID"
this.Cut.enabled = ctrl
this.Copy.enabled = ctrl
this.Paste.enabled = ctrl
this.Undo.enabled = ctrl
this.PASTE_SPECIAL.enabled = ctrl
endclass
/////////////////////////////////////////////////////////////////////////////////////////////
/////// ...and here is my menu CODE, (want I say my, I am not
/////// taking any credit, this is all thanks to the generosity of
/////// this group ( my life line ).
/////////////////////////////////////////////////////////////////////////////////////////////
** END HEADER -- do not remove this line
//
// Generated on 02/25/2008
//
parameter formObj
new TRYTHISMENU(formObj, "root")
class TRYTHISMENU(formObj, name) of MENUBAR(formObj, name)
this.FILE = new MENU(this)
with (this.FILE)
text = "File"
endwith
this.FILE.ABORT = new MENU(this.FILE) ////
with (this.FILE.ABORT) ////
onClick = class::ABORT_ONCLICK1 ////
text = "Abort"
////
endwith
////
////
this.FILE.CLOSE = new MENU(this.FILE) //// this 2 are
the same for now!
with (this.FILE.CLOSE) ////
onClick = class::CLOSE_ONCLICK1 ////
text = "Close" ////
endwith ////
this.EDIT = new MENU(this)
with (this.EDIT)
text = "Edit"
endwith
this.EDIT.UNDO = new MENU(this.EDIT)
with (this.EDIT.UNDO)
text = "Undo"
endwith
this.EDIT.CUT = new MENU(this.EDIT)
with (this.EDIT.CUT)
text = "Cut"
endwith
this.EDIT.COPY = new MENU(this.EDIT)
with (this.EDIT.COPY)
text = "Copy"
endwith
this.EDIT.PASTE = new MENU(this.EDIT)
with (this.EDIT.PASTE)
text = "Paste"
endwith
////////////////////////////////////////////////////// Functions and
Procedures ///////////////////////
function ABORT_onClick1
form.CLOSE()
return
function CLOSE_onClick1
form.CLOSE()
return
endclass
I have a form with a menu attached.
On the MENU
COPY_CUT_PASTE_UNDO works just right.
This form has also 4 buttons (COPY-CUT-PASTE-UNDO)
Copy, Cut, Paste also works just FINE, however the UNDO
does NOT.
Does any one knows why, since the 3 bottoms works OK?
It that something to do with the UNDO on the FORM, since on
the MENU it works OK?
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////// Here is the code on the form
///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
this.rowset = this.employees1.rowset
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function BITMAPFIRST1_onOpen
form.employees1.rowset.first()
if form.employees1.rowset.endOfSet
form.employees1.rowset.first()
msgbox="You are at begining of file"
else
endif
return
function PUSHBUTTON1_onClick //copy
if type( "form.activeControl.copy" ) == "FP"
form.activeControl.copy()
form.PUSHBUTTON1.setfocus()
endif
return
function PUSHBUTTON2_onClick //cut
if type( "form.activeControl.cut" ) == "FP"
form.activeControl.cut()
form.PUSHBUTTON2.setfocus()
endif
return
function PUSHBUTTON3_onClick //paste
if type( "form.activeControl.paste" ) == "FP"
form.activeControl.paste()
form.PUSHBUTTON3.setfocus()
endif
return
function PUSHBUTTON4_onClick //UNDO .....HERE IS MY PROBLEM
FOR NOW.....
if type( "form.activeControl.undo" ) == "FP"
form.activeControl.undo()
form.PUSHBUTTON4.setfocus()
endif
return
function form_onOpen
this.root.EDITUNDOMENU:=this.root.EDIT.UNDO
this.root.EDITCOPYMENU:=this.root.EDIT.COPY
this.root.EDITCUTMENU:=this.root.EDIT.CUT
this.root.EDITPASTEMENU:=this.root.EDIT.PASTE
return
endclass
/////////////////////////////////////////////////////////////////////////////////////////////////
///// Here is also the code about the menu in the form ////////////////
///////////////////// 2nd class on the form
////////////////////////////////////////
Parameter FormObj,PopupName
NEW EDINFOPOPUP(FormObj,PopupName)
CLASS EDINFOPOPUP(FormObj,PopupName) OF POPUP(FormObj,PopupName)
this.Left = 0
this.Top = 0
this.TrackRight = .F.
this.Alignment = 1
this.OnInitMenu = CLASS::ROOT_ONINITMENU
DEFINE MENU COPY OF THIS;
PROPERTY;
Text "Copy",;
OnClick {; form.activeControl.Copy()}
DEFINE MENU PASTE OF THIS;
PROPERTY;
Text "Paste",;
OnClick {; form.activeControl.Paste()}
DEFINE MENU CUT OF THIS;
PROPERTY;
Text "Cut",;
OnClick {; form.activeControl.Cut()}
DEFINE MENU UNDO OF THIS;
PROPERTY;
Text "Undo",;
OnClick {; form.activeControl.Undo()} //<<<< this is the one not
working >>>> //////////
Procedure ROOT_OnInitMenu
control=form.activeControl
ctrl= control.className $ "ENTRYFIELD|EDITOR|BROWSE|GRID"
this.Cut.enabled = ctrl
this.Copy.enabled = ctrl
this.Paste.enabled = ctrl
this.Undo.enabled = ctrl
this.PASTE_SPECIAL.enabled = ctrl
endclass
/////////////////////////////////////////////////////////////////////////////////////////////
/////// ...and here is my menu CODE, (want I say my, I am not
/////// taking any credit, this is all thanks to the generosity of
/////// this group ( my life line ).
/////////////////////////////////////////////////////////////////////////////////////////////
** END HEADER -- do not remove this line
//
// Generated on 02/25/2008
//
parameter formObj
new TRYTHISMENU(formObj, "root")
class TRYTHISMENU(formObj, name) of MENUBAR(formObj, name)
this.FILE = new MENU(this)
with (this.FILE)
text = "File"
endwith
this.FILE.ABORT = new MENU(this.FILE) ////
with (this.FILE.ABORT) ////
onClick = class::ABORT_ONCLICK1 ////
text = "Abort"
////
endwith
////
////
this.FILE.CLOSE = new MENU(this.FILE) //// this 2 are
the same for now!
with (this.FILE.CLOSE) ////
onClick = class::CLOSE_ONCLICK1 ////
text = "Close" ////
endwith ////
this.EDIT = new MENU(this)
with (this.EDIT)
text = "Edit"
endwith
this.EDIT.UNDO = new MENU(this.EDIT)
with (this.EDIT.UNDO)
text = "Undo"
endwith
this.EDIT.CUT = new MENU(this.EDIT)
with (this.EDIT.CUT)
text = "Cut"
endwith
this.EDIT.COPY = new MENU(this.EDIT)
with (this.EDIT.COPY)
text = "Copy"
endwith
this.EDIT.PASTE = new MENU(this.EDIT)
with (this.EDIT.PASTE)
text = "Paste"
endwith
////////////////////////////////////////////////////// Functions and
Procedures ///////////////////////
function ABORT_onClick1
form.CLOSE()
return
function CLOSE_onClick1
form.CLOSE()
return
endclass