Hi,
On 07.10.2012 11:36, Andrey Cherepivskiy wrote:
> I'm creating a simple module, that should interact with user via textbox
> widget.
>
> First I created mymodule.lua and went with the following:
>
> ...
> mywidget = widget({ type = "textbox" })
> ...
> module("mymodule")
This creates the widget in the global namespace and not in your module. You want
to swap these two lines. However, that would mean that "widget" is no longer
visible. So what you want is:
local widget = widget
module("mymodule")
mywidget = widget({ type = "textbox" })
> function boo()
> mywidget.text='buka'
> end
>
> and I refer to this widget in rc.lua:
>
> require("mymodule")
> ...
> mywibox[s].widgets = {
> ...
> mymodule.mywidget,
> ...
> layout = awful.widget.layout.horizontal.rightleft
> }
>
>
> This code loads without error, but mywidget remains nil.
>
> I looked in several modules made by other people, and nowhere I found
> a widget creation. Maybe I do this just the wrong way? I'm not very
> good in lua.
>
> Now I made the work around, I created the widget in rc.lua and passed
> it to my module.
>
> How would I create widget in my module? (Or why I ain't supposed to do this?)
Cheers,
Uli
--
If you have to type the letters "A-E-S" into your source code, you're doing it
wrong.
--
To unsubscribe, send mail to [email protected].