Closed tgonzalez89 closed 3 years ago
hhhmmmmm that's a problem
I just realised this is a larger issue dealing with how the program handles mouse input. I'm currently in the process of fixing this. This will change the use of the program, unfortunately, so will probably in be a new release (v1.0.0).
I was going to file another issue, but I think it is probably related to this one. If I click on an item of a dropdown menu and another widget is positioned behind the dropped dropdown menu, the widget behind also gets clicked. The workaround I did was to hide the button that was getting clicked while the dropdown is dropped and then show the hidden button once the dropdown is no longer dropped.
perhaps the best way is to implement a layer-ish way of displaying the widgets aka putting them in an ordered list. Then search from the end which widget have been clicked on
perhaps the best way is to implement a layer-ish way of displaying the widgets aka putting them in an ordered list. Then search from the end which widget have been clicked on
@AustL is that's the case we need to implement a new Window
class that handle this
like this perhaps
class Window:
def __init__(self, size) -> None:
self.__widgets = list()
def _add_widgets(self, new_widget, pos =None):
"""add widget to the window
:param new_widget: the new widget to add to 'self'
:type new_widget: widget
:param pos: position of the widget in the list, defaults to None
:type pos: intor None, optional
"""
self.__widgets.append(new_widget)
def close(self):
pass # close the window
The main problem I see with this is that the module is going to be transformed to become an ui framework and not a library you can easily use in your project
@slashformotion I've already started doing this. Most of this will occur automatically, so changes to the usage will be minimal.
@AustL i looked the branch, it's pretty smart
I was going to file another issue, but I think it is probably related to this one. If I click on an item of a dropdown menu and another widget is positioned behind the dropped dropdown menu, the widget behind also gets clicked. The workaround I did was to hide the button that was getting clicked while the dropdown is dropped and then show the hidden button once the dropdown is no longer dropped.
This issue is fixed for the dropdown, however, it still occurs for the combobox widget. This is due to the combobox being triggered on 'click', while the dropdown is triggered on 'release'. Based on the implementation of the combo-box, I can't find an easy fix. I think when the dropdown menu closes, the mouse click somehow still registers for the button, although it does not when one widget covers another (like two buttons overlapping).
The mouse and widget handling system is now working, so I will create a beta-release until I can document it properly.
How to reproduce: 1) Press the mouse button outside any widget button area. 2) Drag the mouse (with the mouse button still pressed) into a widget button num. 1 area. 3) Observe that the onClick function is called for button num. 1. 4) With the mouse button still pressed keep dragging into another button. 5) Observe that the onClick function is called for button num. 2.
Video illustrating the issue