Originally Posted by Sweetsour
Is there a way I can access the element (the minimap button) to have the ability to set its point using :SetPoint() (outside of this code)?
|
You should really not be doing that. Why do you need to move the minimap button independently of the user?
If you just want to provide your own options for moving the button around the minimap instead of just letting the user click and drag it, just modify the "minimapPos" value (it's an angle) in your settings table (the one you passed to LibDBIcon) and then tell the library to refresh.
I think there used to be better documentation, but the following methods are available:
lib:Register(name, object, db)
- name: string, should just use the same name you gave LibDataBroker
- object: table, same one you gave LibDataBroker, which is also what LDB:NewDataObject returns a ref for
- db: table, should be in your SavedVariables somewhere, will store info on whether the button should be shown/hidden, and where around the minimap to show it
lib:Lock(name)
lib:Unlock(name)
Disable or enable dragging to move the specified button. Stored as a boolean under the "lock" key in the db.
lib:Hide(name)
lib:Show(name)
Hide or show the specified button. These methods don't store the state in the db; set a boolean under "hide" yourself.
lib:IsRegistered(name)
Exactly what it sounds like. Not really any reason to use this method in addons.
lib:Refresh(name, db)
Refreshes the visibility, position, and lock state of the button. If "db" is provided, it overwrites the previous one; this is intended for use with eg. AceDB-3.0 profile switches. If "db" is not provided, it uses the one given with :Register. This is all done automatically when you :Register, so you only need to call this after modifying db values yourself.
lib:GetMinimapButton(name)
Gets a reference to the actual button object. You should generally not use this unless you want to do something like change the button appearance. If you want to move/hide/lock the button, use the appropriate lib methods instead.