I'm using a scripts that Geoff Meredith created to disable buttons and to change the mouseover. It works great (The original script and functions can be found here: (http://msgboard.alphasoftware.com/al...disable+button).
I'm playing a script on the Oninit event to disable the buttons. This script is used on all my forms. The script could disables 20 specified buttons but (depending on the form) there are only 5 to 15 buttons on a form. When (by mistake) a button is created with a name not specified in the script the button is not disabled. Is it possible to disable and set the mouseover for all buttons no matter how the button is named.
ONINIT script play on each form
I'm playing a script on the Oninit event to disable the buttons. This script is used on all my forms. The script could disables 20 specified buttons but (depending on the form) there are only 5 to 15 buttons on a form. When (by mistake) a button is created with a name not specified in the script the button is not disabled. Is it possible to disable and set the mouseover for all buttons no matter how the button is named.
Code:
FUNCTION button_disable AS C (ob_name AS C, mode AS C ) command="parentform:"+ob_name+".object.enabled="+mode evaluate_template(command) END FUNCTION
Code:
FUNCTION button_flyover AS C (ob_name AS C, fill_colour AS C, fill_accentcolour AS C) if fill_colour="" then newcode="parentform:"+ob_name+".event.onflyover=\"\"" else dim q as c dim bs as c q="\"" bs="\\" newcode="parentform:"+ob_name+".event.onflyover="+q+"this.fill.color ="+q+"+"+q+bs+q+fill_colour+bs+q+q+"+"+"crlf()"+"+"+q+"this.fill.accent_color="+q+"+"+q+bs+q+fill_accentcolour+bs+q+q end if evaluate_template(newcode) parentform.Refresh_Layout() END FUNCTION
ONINIT script play on each form
Code:
if user_groups() = "watch change" then this.restrict_change = .t. this.restrict_enter = .t. this.restrict_delete = .t. else end if if user_groups() = "watch only" then controlpanel.hide() this.restrict_change = .t. this.restrict_enter = .t. this.restrict_delete = .t. button_disable("button1",".f.") button_disable("button2",".f.") button_disable("button3",".f.") button_disable("button4",".f.") button_disable("button5",".f.") button_disable("button6",".f.") button_disable("button7",".f.") button_disable("button8",".f.") button_disable("button9",".f.") button_disable("button10",".f.") button_disable("button11",".f.") button_disable("button12",".f.") button_disable("button13",".f.") button_disable("button14",".f.") button_disable("button15",".f.") button_disable("button16",".f.") button_disable("button17",".f.") button_disable("button18",".f.") button_disable("button19",".f.") button_disable("button20",".f.") button_flyover("button1","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button2","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button3","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button4","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button5","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button6","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button7","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button8","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button9","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button10","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button11","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button12","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button13","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button14","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button15","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button16","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button17","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button18","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button19","#193,223,254","Win3D") ' (object name, fill color, fill accent color) button_flyover("button20","#193,223,254","Win3D") ' (object name, fill color, fill accent color) topparent.MenuItemEnable("rapport", .f.) topparent.MenuItemEnable("new record", .f.) topparent.MenuItemEnable("change record", .f.) topparent.MenuItemEnable("design mode", .f.) else end if