Prevent a window from being draggable.
I have been digging through the wiki and I can not find anything that will allow you to prevent a window from being draggable.
Anyone got any ideas? |
save the x and y position when the window is placed where you want it and then allow or disallow dragging in the PositionChanged event by setting the SetPosition to those saved x and y coords, self.movable is a flag you define yourself that you can set to allow positioning ( like in the constructor ), you can set that to false if you don't want it to be dragged anymore
Code:
function SomeClass:Constructor() |
I have tried this code a million different ways and I can not figure out how to append it to my settings window to get it to lock and unlock the window when a check block is selected.
SetupWindow.lua Code:
import "Turbine"; Code:
import "Turbine"; Any help is greatly appreciated. A lot of the time I can figure out and work through the code, but this is really stumping me. |
This is a really dirty hack - but it's oh-so effective
Code:
myWindow = Turbine.UI.LotRO.Window() |
Nice, that's pretty smart...I will try it tonight!
|
@DU
Not sure why this isn't working... can you take a look at it when you get a sec?
The code in question is in the second block of code under ----LOCK WINDOW---- Code:
import "Turbine"; Code:
import "Turbine"; |
No...no.
See, you add that window/control to the window when you make the window itself, starting off with a background color so you can place and size it correctly. Once you do that, the only thing you have to put in your conditional is switching mouse visible on and off. eg: Code:
SetupWindow = class(Olenn.DUInterface.Window ); Code:
if ( SetupWindow.locked:IsChecked(true) ) then Code:
SetupWindow.locked.CheckChanged = function (sender,args) |
I think there is a basic key understanding of Lua that I am missing. Here is the error;
Code:
...Rings Online\Plugins\Olenn\Satchel\SatchelWindow.lua:206: attempt to index field 'locked' (a nil value) Here is all of the code thus far. SatchelWindow.lua Code:
import "Turbine"; Code:
import "Turbine"; |
In SatchelWindow.lua this part
Code:
import "Turbine"; Code:
import "Turbine"; As for your error about main, basically its telling you it can't load SatchelWindow.lua because of the above problem (SetupWindow.locked doesnt exsist because you didnt create an instance of the class setupWindow). Since it can't load that file init.lua cant import the Olen.SatchWindow package. Which also means that Main.lua cant import the Olen.Satchel package. Usually when you get a string of errors like that, you wanna just focus on the first one listed. Because quite often the unable to import errors are caused by that. |
Quote:
SetupWindow and SatchelWindow are classes, and as such do nothing unless an instance is made of them. eg: Code:
--in Main.lua Ever see one of those suburban neighborhoods where it's obvious that all the houses were built off the same blueprints, and the only thing really different about them is the changes the owners made to them (i.e. paint color)? If that were a program, each house would be an instance of the same class. eg: Code:
myhouse = House(); Code:
myhouse:Paint(red); Code:
myPool = Pool(); Code:
myPool:AddLight() Code:
House = class( Entertainment.Outside ); On the other hand, doing something like this, in the same class/file as you created instances of houses would work Code:
if (myPool:isAboveGround()==true)then Code:
House = class( Entertainment.Outside ); Now that we have a declaration of Pool inside House, we can still access it from outside of House as well eg: Code:
myHouse.zePool:AddLight(); |
All times are GMT -5. The time now is 05:44 AM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI