I get to the stage in my program where I want to lockout the control panel and test my program from startup. When I did this I then I used to have to either build an access process/button on main startup page to take me to the control panel to fix design issues; or use ctl+alt+shift on entry to by pass all settings.
I created a work around that someone might find useful. In the autoexec I dim a global variable. In my case I called it cpcode
The in the onkey event to the main startup form I place the following code
Now all i do is type 123 and hit the enter key
I created a work around that someone might find useful. In the autoexec I dim a global variable. In my case I called it cpcode
The in the onkey event to the main startup form I place the following code
Dim mykey as c
If a_user.key.value <> "{enter}" then
a_user.key.handled = .T.
IF a_user.key.event = "down" THEN
mykey = a_user.key.value
cpcode = cpcode + mykey
END IF
end if
If a_user.key.value = "{enter}" then
a_user.key.handled = .T.
IF a_user.key.event = "down" then
if cpcode = "123" then
'Close current form or browse window.
DIM mode as c
mode = parentform.mode_get()
'If the form is in Enter or Change mode, first save the changes before closing the form
if mode = "ENTER" .or. mode = "CHANGE" then
parentform.commit()
'Check to see if the record was successfully saved
if parentform.mode_get()<>"VIEW" then
ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
end
end if
end if
'Close the form
parentform.close(.f.)
'Show the Control Panel (after previously hiding it).
:controlpanel.show()
cpcode = ""
end if
end if
end if
If a_user.key.value <> "{enter}" then
a_user.key.handled = .T.
IF a_user.key.event = "down" THEN
mykey = a_user.key.value
cpcode = cpcode + mykey
END IF
end if
If a_user.key.value = "{enter}" then
a_user.key.handled = .T.
IF a_user.key.event = "down" then
if cpcode = "123" then
'Close current form or browse window.
DIM mode as c
mode = parentform.mode_get()
'If the form is in Enter or Change mode, first save the changes before closing the form
if mode = "ENTER" .or. mode = "CHANGE" then
parentform.commit()
'Check to see if the record was successfully saved
if parentform.mode_get()<>"VIEW" then
ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
end
end if
end if
'Close the form
parentform.close(.f.)
'Show the Control Panel (after previously hiding it).
:controlpanel.show()
cpcode = ""
end if
end if
end if
Comment