[GUI] search widget?

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

[GUI] search widget?

Post by white_haired_uncle »

Is there a widget that provides text search, and maybe some docs/examples?

I'm looking at data/gui/window/unit_recruit.cfg. It has a text_box, with that promising FILTER_TEXT_BOX_HINT. But I can't find the stuff that actually acts on said text.

I guess I could roll my own based on text_box:on_modified, but I don't want to and I suspect performance may not be all that great.

TIA
Speak softly, and carry Doombringer.
User avatar
Pentarctagon
Project Manager
Posts: 5567
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: [GUI] search widget?

Post by Pentarctagon »

For mainline, those sorts of UI functions are usually implemented in C++, so that wouldn't be something that'd be useful as an example for UMC.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [GUI] search widget?

Post by white_haired_uncle »

Any idea how hard it would be to take what exists for recall and turn it into a widget? I think it would be quite useful, though ATM I'm having a hard time figuring out how the search would be scoped.
Speak softly, and carry Doombringer.
User avatar
Pentarctagon
Project Manager
Posts: 5567
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: [GUI] search widget?

Post by Pentarctagon »

Probably either pretty hard or not really generally applicable, since each dialog tends to structure the data it's using differently and a search of course needs to know what parts of the data structure to look in.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Celtic_Minstrel
Developer
Posts: 2241
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [GUI] search widget?

Post by Celtic_Minstrel »

I went looking, thinking there should be something that at least allows you to write definition=search or definition=filter to get the appearance of a search box, but sadly that seems to be missing. While I'm not sure if the search functionality is worth adding to core, I think the appearance would be.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [GUI] search widget?

Post by white_haired_uncle »

Copying from gui/window/lobby_main.cfg and gui/macros/_initial.cfg:

T.text_box {definition = "default",id = "filter_text",hint_text = _ "Search",hint_image = "icons/action/zoomdefault_25.png~FL(horiz)" }

gives me a text_box that looks like a search box.

And now I have something new to document. Great.
Speak softly, and carry Doombringer.
Post Reply