I'm trying to determine how the different functions for the pop up dialog are fired off.
Specifically I am confused about :Run and :OnOk.
:Run goes first obviously.
:OnOk fires off when the okay button is clicked. However during some simple testing I change a global variable during :Run, but when okay is clicked this variable has the original value... but then is changed again by :Run a split second AFTER :OnOk.
It almost seems as if :Run happens twice? Why are variables not being updated?
This seems to be the main problem with my copy/paste script. Code fired in the :Run function doesn't effect variables defined for when :OnOk is fired.
I may have to put in two buttons to copy and paste the bones, then just use the "okay" to close the window when finished, not have it do anything at all, but If I change the global variable with a button in the UI it changes back to the default value after okay is clicked, and the second "Run" also is not effected.
I'm very confused. Any help appreciated.
-vern
Simple dialog UI - order of functions?
Moderators: Víctor Paredes, Belgarath, slowtiger
Okay, I think I got it.
The :Run function runs when a menu script is "activated". The :Run script activates the dialog. I have the simple dialog "built" as the first thing in the :Run function. :Run appears to stop at this point. I have a bit of code that changes a global variable at the end of :Run which doesn't happen until the okay button is pushed.
:Run FINISHES AFTER :OnOk is activated and does its thing.
If there is code to be run after the UI stuff is built in the :Run function it doesn't get "processed" until after the okay button is pressed and THAT function runs. Any variable assignments that occur during the :OnOk function are overwritten by the :Run function "finishing up".

This explains a lot to me. I am beginning to see why a two script option is easier to deal with for pasting bones... I won't do that of course... this is war now and I'm determined to WIN at all costs.
My path forward is clearer now.
p.s. As you can see... I am kind of hungry right now.
-vern
The :Run function runs when a menu script is "activated". The :Run script activates the dialog. I have the simple dialog "built" as the first thing in the :Run function. :Run appears to stop at this point. I have a bit of code that changes a global variable at the end of :Run which doesn't happen until the okay button is pushed.
:Run FINISHES AFTER :OnOk is activated and does its thing.
If there is code to be run after the UI stuff is built in the :Run function it doesn't get "processed" until after the okay button is pressed and THAT function runs. Any variable assignments that occur during the :OnOk function are overwritten by the :Run function "finishing up".

This explains a lot to me. I am beginning to see why a two script option is easier to deal with for pasting bones... I won't do that of course... this is war now and I'm determined to WIN at all costs.
My path forward is clearer now.
p.s. As you can see... I am kind of hungry right now.
-vern
Debugging code is an art form ... an art form of discipline.
It is turning off your intellect and descending to the level of the computer. A computer does exactly what you tell it to do. It is not intelligently interpreting what it should do, it just does what you say it to do.
Dealing with computer is like dealing with a retarded individual. Only a retard is infinitely more intelligent than your average Joe's computer from the around the corner grocery store. If you kick a retard, he will avoid your kick the next time you kick him. If you kick your computer, it won't budge an inch, how many times you kick it.
You may threaten it with a sledgehammer, and tell it will be destroyed if it doesn't do what you tell it to do. Doesn't matter... It isn't impressed by your tantrums, because it doesn't have a concept what "tantrum" is.
It's just a dumb computer.
Happy coding, Vern
It is turning off your intellect and descending to the level of the computer. A computer does exactly what you tell it to do. It is not intelligently interpreting what it should do, it just does what you say it to do.
Dealing with computer is like dealing with a retarded individual. Only a retard is infinitely more intelligent than your average Joe's computer from the around the corner grocery store. If you kick a retard, he will avoid your kick the next time you kick him. If you kick your computer, it won't budge an inch, how many times you kick it.
You may threaten it with a sledgehammer, and tell it will be destroyed if it doesn't do what you tell it to do. Doesn't matter... It isn't impressed by your tantrums, because it doesn't have a concept what "tantrum" is.
It's just a dumb computer.
Happy coding, Vern
