Download
(6 Kb)
Download
Updated: 10-09-11 07:53 AM
Updated:10-09-11 07:53 AM
Created:10-01-11 06:02 PM
Downloads:197
Favorites:2
MD5:
FooBar
Version: 1.1
by: Neglected [More]
I am no longer maintaining this AddOn! Feel free to take over it should you wish.

OK, so this is my first AddOn and I decided that I'd make something similar to TitanPanel or FuBar from the other game. I think I have done this rather well considering it is my first AddOn (I'm no newb to Lua, though).

Basically, this AddOn will create a plain black bar at the top of the screen, stretching the length of the screen and being 20 pixels in height. In this bar, you can add FooBarModules, which are basically labels of text that can have events on them. For example, you could create a module using the following code:

Code:
mod = FooBarModule:new(FooBar.getFoobar(), "MyModule");
mod:setText("My Test Module");
mod:registerEvent("MouseIn", function() print("I was touched in bad places :("); end);
Which would create a Module on the next available place on the bar that would display "My Test Module" on the bar, and would print "I was touched in bad places " to the chat window when moused over.

This is intended to be loaded as a separate AddOn but set as a before dependency in your AddOn if you wish to use it.
Code:
Dependencies = {
	FooBar = {"required", "before"},
};
Once you have done this, you can create modules at your whim. They can be stored in variables and you can check if they are modules by doing either of the following:
Code:
if unknownVariable._type ~= nil and unknownVariable._type == "FooBarModule" then
   ...
end

if unknownFooBarType:getType() == "FooBarModule" then
   ...
end
You can attach events to the FooBar modules using registerEvent(EventName, Function) where EventName is any Frame event.

When you create a module, it will be placed at the next possible slot on the bar. Please ONLY use the Wrapper methods provided, or write your own but make sure to change the module bar's height and call FooBar:OnDimensionsChanged() each time you anticipate the FooBar's height and width will change in order to keep things synchronized.

Feel free to submit updates and patches to this.
~Neglected.

Code:
CHANGELOG:
  1.0 - Initial Release.
  1.0.1 - Removed test code. Woops.
  1.0.2 - Added example
        - Changed FooBarModule:new() arguments. It now takes (name[, parent]).
  1.1   - Added limited support for LibDataBroker. I say limited because I'm really not sure how to implement it properly. In terms of displaying changes etc.

Example Module
This example module will print Hello, World when it is clicked on.
Code:
do
	myModule = FooBarModule:new("MyModule");		-- If parent is specified for :new(), it will automatically hook on to the default FooBar.
	myModule:setText("My First Module");
	local function myModuleLeftClick()
		print("Hello, World!");
	end
	myModule:registerEvent("LeftClick", myModuleLeftClick)
end
Optional Files (0)


Archived Files (1)
File Name
Version
Size
Author
Date
1.0.1
4kB
Neglected
10-01-11 06:05 PM


Post A Reply Comment Options
Unread 10-13-11, 12:19 PM  
RagebeastRT
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 118
Uploads: 8
Toggles

Do you plan on adding a rightclick event to the bar where you can show/hide modules like Titan has?
RagebeastRT is offline Report comment to moderator  
Reply With Quote
Unread 10-13-11, 11:51 AM  
RagebeastRT
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 118
Uploads: 8
New problem

Well, ran into another problem. Everything works great as long as I have foobar turned on but if I toggle it off i get errors in my addon. I looked through the code in your descript but I get errors when trying to use it. I am most likely not placing it were it should be.

Disregard, fixed by placing the code block inside an if block:
if FooBarModule ~= nil then
...
end
Last edited by RagebeastRT : 10-13-11 at 12:17 PM.
RagebeastRT is offline Report comment to moderator  
Reply With Quote
Unread 10-13-11, 11:19 AM  
RagebeastRT
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 118
Uploads: 8
When first loading the bar shows about 2/3 across my screen, when I do a /reloadui it goes all the way across.
As to my code not working, it was calling a localized function in my core code. I removed the local and it works fine now.


Quote:
Originally posted by Neglected
Try reloading the UI when this happens. That is kinda odd, because I also use a changed global UI scale (very very small) and it goes right across the screen for me. The code itself uses the size of the UIParent context, so it should be fine.


Probably because I didn't' actually test it and I made an error as it was late when I made the example - it was merely there as that, just an example, as it shows you how to use it. :P

EDIT:
I locallized the handler inside the "do" loop. Please remove this - the function went out of scope, causing nil value errors. My fault. :P

For future reference btw, could anyone giving an error report submit a stacktrace (nkDebug will do this quite well) - it'll help a lot :3
RagebeastRT is offline Report comment to moderator  
Reply With Quote
Unread 10-11-11, 03:02 AM  
Gwyddion

Forum posts: 0
File comments: 5
Uploads: 0
Thumbs up Curse

Put this on Curse, and you will be Glorified with the Gwyddion faction.
Gwyddion is offline Report comment to moderator  
Reply With Quote
Unread 10-10-11, 12:17 PM  
Neglected
Bomani Harbinger
AddOn Author - Click to view AddOns

Forum posts: 5
File comments: 3
Uploads: 1
Quote:
Originally posted by RagebeastRT
When using a changed global ui scale (Settings/Interface/Display) The bar does not go all the way across the screen.
Try reloading the UI when this happens. That is kinda odd, because I also use a changed global UI scale (very very small) and it goes right across the screen for me. The code itself uses the size of the UIParent context, so it should be fine.
Quote:
Originally posted by RagebeastRT
I tried out your example module. renamed it and placed it in my addon folder.
It shows up on your foobar but when I click it gives me an error that my window function not found. This isnt a prob with your code, just any suggestions I can do on my end. Was merely trying to run the routine that toggled the display of the window. [/b]
Probably because I didn't' actually test it and I made an error as it was late when I made the example - it was merely there as that, just an example, as it shows you how to use it. :P

EDIT:
I locallized the handler inside the "do" loop. Please remove this - the function went out of scope, causing nil value errors. My fault. :P

For future reference btw, could anyone giving an error report submit a stacktrace (nkDebug will do this quite well) - it'll help a lot :3
__________________
Quote:
<+Nobgul> Only a real man can appreciate pink
Last edited by Neglected : 10-10-11 at 12:19 PM.
Neglected is offline Report comment to moderator  
Reply With Quote
Unread 10-09-11, 03:05 PM  
RagebeastRT
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 118
Uploads: 8
When using a changed global ui scale (Settings/Interface/Display) The bar does not go all the way across the screen.

I tried out your example module. renamed it and placed it in my addon folder.
It shows up on your foobar but when I click it gives me an error that my window function not found. This isnt a prob with your code, just any suggestions I can do on my end. Was merely trying to run the routine that toggled the display of the window.
Last edited by RagebeastRT : 10-09-11 at 03:34 PM.
RagebeastRT is offline Report comment to moderator  
Reply With Quote
Unread 10-09-11, 02:46 PM  
Neglected
Bomani Harbinger
AddOn Author - Click to view AddOns

Forum posts: 5
File comments: 3
Uploads: 1
Quote:
Originally posted by fostot
Neglected, I second the LibDataBroker option, if you could just make this into a LDB Display Panel this would rock. If you want to look at other LDB Displays check out DockingStation / ChocolateBar on wowinterface.com
I'll take a look soon (tm) - I've never worked with LDB before, but I'll give it a shot. I tried incorporating it earlier and I did (very limited), but my main issue is I don't really know HOW to incorporate it - as in, choosing what data to show, etc.
__________________
Quote:
<+Nobgul> Only a real man can appreciate pink
Neglected is offline Report comment to moderator  
Reply With Quote
Unread 10-09-11, 12:39 PM  
fostot
Zombie
 
fostot's Avatar

Forum posts: 3
File comments: 28
Uploads: 0
Neglected, I second the LibDataBroker option, if you could just make this into a LDB Display Panel this would rock. If you want to look at other LDB Displays check out DockingStation / ChocolateBar on wowinterface.com
fostot is offline Report comment to moderator  
Reply With Quote
Unread 10-09-11, 06:05 AM  
Neglected
Bomani Harbinger
AddOn Author - Click to view AddOns

Forum posts: 5
File comments: 3
Uploads: 1
Re: Modules

Quote:
Originally posted by RagebeastRT
Could you make a small module and include with the addon. I would like to see some kind of an example as Im not sure how to hook into this.
I can indeed, I'll write one up after I hit 10 on my cleric (not long now aha).
Edit: I have now added a sample file inside the ExampleModule.lua file inside the Addon. It is also loaded in the RiftAddon.toc file, so you can see the results.

Quote:
It would be great if you also hosted this at Curse. And support LibDataBroker-1.0 for Rift
I'll give it a shot, good sir.
__________________
Quote:
<+Nobgul> Only a real man can appreciate pink
Last edited by Neglected : 10-09-11 at 06:47 AM.
Neglected is offline Report comment to moderator  
Reply With Quote
Unread 10-07-11, 08:35 PM  
Myrroddin
Endless Captain
AddOn Author - Click to view AddOns

Forum posts: 50
File comments: 8
Uploads: 4
It would be great if you also hosted this at Curse. And support LibDataBroker-1.0 for Rift
Myrroddin is offline Report comment to moderator  
Reply With Quote
Unread 10-05-11, 08:15 PM  
RagebeastRT
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 118
Uploads: 8
Modules

Could you make a small module and include with the addon. I would like to see some kind of an example as Im not sure how to hook into this.
RagebeastRT is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: