Hello, at the moment i have 3 buttons. In one of the buttons when something is loaded i want to for example remember that number or remember that RGBColour on the picture. So then when the reset button is pressed it goes to original. I have written the code so it saves the first value but then i can’t access that code from any other button. how could i make my buttons A Public variable so i can access it from anywhere on the programm.
This is the code atm
dim Surf2 as RGBSurface = File.RGBSurface
To make it Global / Public, how is this done ??
Click on the blue cube at the top left of the screen called Insert. Choose Module from the list. Highlight your new module, then click on the + button and add a Method (or type Option-Command-M).
Place your code in here. It is now accessible by all your program windows and buttons.
In the insert option, you can add new windows, classes, and modules
If you are familiar with a window, you can imagine the module as a window with no controls.
If you call your module ‘PublicStuff’ , you can refer to the properties and constants either like this:
PublicStuff. Surf2 = File.RGBSurface
Surf2 = File.RGBSurface
if those variables are set to be ‘public’ in the designer.
remove the dim Surf2 as RGBSurface from your button code
Unlike a window, you dont have to explicitly cause the contents of a module to be created at runtime.
BTW: this blue cube have a use ?