Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListWidget + WidgetListAdapter = child widgets don't work #538

Closed
drug007 opened this issue Jan 21, 2018 · 4 comments · Fixed by #690
Closed

ListWidget + WidgetListAdapter = child widgets don't work #538

drug007 opened this issue Jan 21, 2018 · 4 comments · Fixed by #690

Comments

@drug007
Copy link

drug007 commented Jan 21, 2018

The following code:

class CustomWidget :  ListWidget {
    this(string ID = null) {
        super(ID);
        styleId = STYLE_EDIT_BOX;

        import dlangui.widgets.lists;
        WidgetListAdapter adapter = new WidgetListAdapter();
        {
            auto tree = new TreeWidget(1.text, ScrollBarMode.Auto);
            tree.parent = this;
            auto child = tree.items.newChild("g1_1", "Group 1");
            foreach(j; 0..3)                
                child.newChild("g1_" ~ j.text, "item "d ~ j.dtext);
            adapter.add(tree);
        }
        ownAdapter = adapter;
        requestLayout();
    }
}

creates a widget, where child widget (TreeWidget) does not react to mouse or keyboard input. @buggins Does WidgetListAdapter support menu only? And functionality for general widget list adapter is not provided yet?

@drug007 drug007 changed the title ListWidget + WidgetListAdapter = chlid widgets don't work ListWidget + WidgetListAdapter = child widgets don't work Jan 21, 2018
@drug007
Copy link
Author

drug007 commented Jan 22, 2018

I found that using tree.styleId("LIST_ITEM"); makes the situation better - I can select an item, scroll them by means both mouse and keyboard. But child TreeWidget doesn't work still.

@triplejam
Copy link
Contributor

@drug007 I could be wrong but I think ListWidgets are more meant for use with text. You could also try extending VerticalLayout for your custom widget.

@drug007
Copy link
Author

drug007 commented Jan 24, 2018

ListWidgets is base for Menu widget, for text there is StringListWidget (or some widget like this). But you're right in sense it seems I need to make this custom widget...

@whitebyte
Copy link
Contributor

Unfortunately my last fix works only partially. While ListWidget children now react to mouse events, their children don't. It means that if there are interactive elements inside a child (such as text inputs, buttons), they are still non-interactive. Their parent (i.e. ListWidget adapter child) steals all the events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants