project-navigation
Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - xray

Pages: 1 [2] 3 4 5
16
Coding / Re: lua design thoughts
« on: December 07, 2014, 05:54:51 pm »
I've added the possibility to set a cvar value to an option list.

17
Coding / Re: lua design thoughts
« on: November 29, 2014, 08:24:14 pm »
Added a fix for the order in wich the close/drag buttons were created.

18
Coding / Re: lua design thoughts
« on: November 26, 2014, 09:36:07 pm »
Another thing.

Window 'mail' is inherited from ipopup.
It has
Code: [Select]
mail:set_closebutton(true)But I don't see any close button somehow.
And another thing is that this window takes up all place.

I've fixed the issues with the close button and the sizing. All these issues were actually related to a fundamental difference in node creating using ufo script and using lua. In ufo script, the node is created, then the properties are read and set and only after that the node is inserted and onLoaded is called. In lua, the node is created, inserted and onLoaded is called. Then the remainder of the lua code sets various properties. This resulted in the isFullscreen flag being incorrect, resulting in the wrong sizing and the closebutton/dragbutton not being created.

19
Coding / Re: lua design thoughts
« on: November 23, 2014, 04:40:02 pm »
P.S. Can you check if on_viewchange is working properly?
In 'mail' window, for example, it has to update scrollbar fullsize and viewsize property and if fullsize is greater than viewsize, scrollbar should appear (autoshowscroll(true)). I don't see scrollbar regardless of the size of the mail text.

You were right. There was a rather annoying bug here. It also prevented the trigger on various other event handlers. I've fixed it and on_viewchange is now properly called. However, this did not solved the viewsize issue. I'll have to look into this a bit further.

I've also changed the creation of nodes. They now are allways dynamic nodes. This triggered an assertion in the execution of func/confunc nodes. It didn't liked dynamic nodes. Possibly to prevent the execution of nodes being deleted. I've removed this assertion but we do need a safeguard against this situation.

20
Coding / Re: lua design thoughts
« on: November 23, 2014, 03:47:37 pm »
OK. I'm going to make all lua created nodes dynamic. This will remove the previous implemented "flags" paramater in the node creation functions.

21
Coding / Re: lua design thoughts
« on: November 23, 2014, 11:16:51 am »
Hmm, seems like nodes created in confuncs are treated as statically created and cannot be removed via remove_childs (which removes only dynamically nodes).

I've added an extra parameter to the node creation functions allowing the creation of dynamic nodes. Usage:
Code: [Select]
local mail = ufo.create_control(mails, "mailheader", "mail" .. index, nil, ufo.DYNAMIC_CONTROL)

This solves the problem, however, I'm not happy with this solution. The solution forces the lua side to have knowledge about static/dynamic nodes and when to use them.

If I look at the code, I have the strong feeling that static nodes are only created during the initial script loading stage and are never created by events and confuncs. If that is the case, the switch between static/dynamic can be made after the parsing stage and it should not become an extra parameter on the lua side. I would like someone to confirm this so I can refactor the implementation.


22
Coding / Re: lua design thoughts
« on: November 22, 2014, 04:51:59 pm »
Hmm, seems like nodes created in confuncs are treated as statically created and cannot be removed via remove_childs (which removes only dynamically nodes).

True. I copied the creation code directly from ui_parse.cpp, the module parsing the ufo scripts. So any node created using lua is basically a static node. However, I think it should be easy to extend the current mechanism with a flag indicating that a dynamic node should be created. I'll look into this.

Quote
Another feature request: implement starlayout and preventtypingescape for uiWindow.

I'll put it on the 'todo' list.

Quote
P.S. btw, just as a matter of fact, 'childs' may be not a proper word, because plural word for 'child' is 'children' :)

I'll rename it. We don't want to have any typos here.

23
Coding / Re: lua design thoughts
« on: November 19, 2014, 08:27:39 pm »
Yet another thing - how to apply string value to cvar?

It is not yet implemented. I've postponed this since I wanted to first find a way to create and reuse variables inside node using lua only. This involves creating lua based table properties that are linked to values stored inside a node. A bit like a callback mechanism only for variables. If I can find a way I can bring lua dynamic variables into the UI.

24
Coding / Re: lua design thoughts
« on: November 19, 2014, 08:20:09 pm »
Fixed a bug in the confunc execution. It should work properly now. Added some improvements to the confunc code also.
As for the call the 'removeAllChild', it wasn't implemented yet. I've added it, however it is renamed to "remove_childs".
Please pull the latest fixes from the repository at rxadmin/ufoai.

I also checked youre translation at:
https://github.com/drone-pl/ufoai/blob/df015731694cb77c069f19724c3046e75f2d67b6/base/ufos/ui/mailclient.ufo

There are some places where you query for a child at the wrong level. E.g. in add_mail, you were referencing "mail:child("header"):child("icon").." however "icon" is positioned as a direct child node of "mail", not "header".
Also index can be directly accessed as it is a parameter given to the call.

I've added the corrected version to the rxadmin/ufoai repository as well.

xray.



25
Coding / Re: lua design thoughts
« on: November 18, 2014, 09:20:17 pm »
Can you post the full translation?

26
Coding / Re: lua design thoughts
« on: November 18, 2014, 08:26:55 pm »
First, can you specify the precise error you encounter?

As for the code, most of it looks okay, with exception of "set_src" that doesn't exist in lua, it was renamed to "set_source".

Also, keep in mind that if you write:
Code: [Select]
add_mail = ufo.create_confunc(mailclient, "add_mail", nil)

you create a global variable add_mail, so this identifier is shared in all modules. If in another module an identical variable "add_mail" is created the last one is preserved. So in general it is better to create module local variables using the local keyword.

Code: [Select]
local add_mail = ufo.create_confunc(mailclient, "add_mail", nil)


27
Coding / Re: lua design thoughts
« on: November 18, 2014, 05:53:27 pm »
Confunc's are nodes. Create them using ufo.create_confunc. Then add an on_click eventhandler.

28
Coding / Re: lua design thoughts
« on: November 18, 2014, 01:07:42 pm »
Just looked into this. Happend on my machine also.  I've already added the fix to the repository rxadmin/ufoai. So with a pull it should be gone.

Thanx for your effort in testing.

29
Coding / Re: lua design thoughts
« on: November 17, 2014, 08:46:07 am »
Code: [Select]
local foo = ufo.create_window("foo", "ipopup")

30
Coding / Re: lua design thoughts
« on: November 16, 2014, 01:54:24 pm »
I'm going to help with converting ufo files to new format.

Great. In that case you'll be needing a listing of the api in lua. See attacheded file for this.

Pages: 1 [2] 3 4 5