I put this here for those that do not want their users to see the control panel. That rascal always shows up these days unless you get a little creative. I thought I would post my solution for anyone that could use it. With this, I can also open or close the control panel for myself but the user never sees it.
'STEPS - Note that everything here is commented. Remove the ' where appropriate
'1. Set a global variable to indicate hidden or not. (I call mine hide182 )
'2. Set a global variable to true if you are running on your machine. (I call mine mymachine )
'3. Put controlpanel.hide() as an on init in your startup form ( I call mine BHS_Manager )
'4. Create a blank screen and add the following as an on init ( I call mine cleanscreen )
' 'Close current form or browse window.
' parentform.close(.f.)
' Open a Form or Browse layout
' DIM Shared varP_BHS_Manager as P
' DIM layout_name as c
' layout_name = "BHS_Manager"
' DIM tempP as p
' tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
' Test if pointer is valid
' if is_object(tempP) then
' Test if pointer refers to a form or browse
' if tempP.class() = "form" .or. tempP.class() = "browse" then
' If so, then activate the already open window
' tempP.activate()
' else
'Window is not already open, so open it
' varP_BHS_Manager = :Form.view(layout_name)
' end if
' else
' varP_BHS_Manager = :Form.view(layout_name)
' end if
'5. Instead of opening your initial screen from your autoexec, open your cleanscreen.
' This is necessary because even if you have a controlpanel.hide() as an on init
' behind your initial screen, the control panel shows up unless you go somewhere else first.
' Add the following as an on init for your first form
' 'Hide the Control Panel and set the variable
' controlpanel.hide()
' var->hide182 = .t.
' if var->mymachine = .f.
' button2.hide()
' hide182.hide()
' end if
'6. Put the following code behind a button on the form you would
' like to open the control panel from. This hides or shows it based on
' the value of hide182
' if var->hide182 = .t.
' :controlpanel.show()
' var->hide182 = .f.
' goto done
' end if
' if var->hide182 = .f.
' :controlpanel.hide()
' var->hide182 = .t.
' end if
' done:
'7. Be sure to hide the button and hide182 if you are not running from your own machine
' For this I have the following code as an on init on the form I open/close the control panel from.
' 'Hide the Control Panel and set the variable
' controlpanel.hide()
' var->hide182 = .t.
' if var->mymachine = .f.
' button2.hide()
' hide182.hide()
' end if
I hope this helps those that endeavor not to confuse their users with what you don't want them to see.
'STEPS - Note that everything here is commented. Remove the ' where appropriate
'1. Set a global variable to indicate hidden or not. (I call mine hide182 )
'2. Set a global variable to true if you are running on your machine. (I call mine mymachine )
'3. Put controlpanel.hide() as an on init in your startup form ( I call mine BHS_Manager )
'4. Create a blank screen and add the following as an on init ( I call mine cleanscreen )
' 'Close current form or browse window.
' parentform.close(.f.)
' Open a Form or Browse layout
' DIM Shared varP_BHS_Manager as P
' DIM layout_name as c
' layout_name = "BHS_Manager"
' DIM tempP as p
' tempP=obj(":"+object_Name_normalize(word(layout_name,1,"@")))
' Test if pointer is valid
' if is_object(tempP) then
' Test if pointer refers to a form or browse
' if tempP.class() = "form" .or. tempP.class() = "browse" then
' If so, then activate the already open window
' tempP.activate()
' else
'Window is not already open, so open it
' varP_BHS_Manager = :Form.view(layout_name)
' end if
' else
' varP_BHS_Manager = :Form.view(layout_name)
' end if
'5. Instead of opening your initial screen from your autoexec, open your cleanscreen.
' This is necessary because even if you have a controlpanel.hide() as an on init
' behind your initial screen, the control panel shows up unless you go somewhere else first.
' Add the following as an on init for your first form
' 'Hide the Control Panel and set the variable
' controlpanel.hide()
' var->hide182 = .t.
' if var->mymachine = .f.
' button2.hide()
' hide182.hide()
' end if
'6. Put the following code behind a button on the form you would
' like to open the control panel from. This hides or shows it based on
' the value of hide182
' if var->hide182 = .t.
' :controlpanel.show()
' var->hide182 = .f.
' goto done
' end if
' if var->hide182 = .f.
' :controlpanel.hide()
' var->hide182 = .t.
' end if
' done:
'7. Be sure to hide the button and hide182 if you are not running from your own machine
' For this I have the following code as an on init on the form I open/close the control panel from.
' 'Hide the Control Panel and set the variable
' controlpanel.hide()
' var->hide182 = .t.
' if var->mymachine = .f.
' button2.hide()
' hide182.hide()
' end if
I hope this helps those that endeavor not to confuse their users with what you don't want them to see.
Comment