[Gambas-user] who to detect if are running inside IDE
adamnt42 at ...626...
adamnt42 at ...626...
Mon Jul 3 22:38:24 CEST 2017
On Mon, 3 Jul 2017 20:40:46 +0200
Tobias Boege <taboege at ...626...> wrote:
> I'm convinced that no matter how you try to detect if you're run by the IDE
> or not, someone can create an environment where your test gives the wrong
> answer. I still stand by my statement from two years ago: you shouldn't care
> where your program is run from in the first place. What problem are you
> trying to solve by knowing that?
>
> Regards,
> Tobi
Since you asked :-)
Laziness!
Many times I have a menu item in a form that just "Stop"s the program i.e.
Private Sub mnuDebug()
Stop
End
then in the Form_Open()
#If Exec
mnuDebug.Visible = False
#Endif
So at development time, or when the customer has a problem, I almost always have a way to stop the program when it's running in the IDE.
All this does is "tidy up" the program automatically when run outside the IDE. If a user wants to go to the extent of creating a non-x version of the program just to see that menu item - which will do nothing anyway since the Stop is ignored - then all I can say is "Good luck to them."
There are probably trickier or even "more correct" ways to hide a menu item at runtime, but hey! Three lines and "As Far As I Care" - problem solved.
b
--
B Bruen <adamnt42 at ...3379... (sort of)>
More information about the User
mailing list