Forum > General

How to bypass an inherited method in immediate ancestor

(1/2) > >>

Joanna:
Hello everyone;
I’m trying to make the tcheckcombobox work better. I have made a new class that inherits tcheckcombobox and I’m trying to override the keydown event. However probably need to call the keydown event for tcustomcombobox combobox how do I access that method without calling the event in tcheckcombobox.keydown first? Since that is the most immediate ancestor . I’ve Already tried typecasting to tcustomcombobox and that didn’t work .

skalogryz:

--- Quote from: Joanna on October 14, 2021, 07:24:37 am ---However probably need to call the keydown event for tcustomcombobox combobox how do I access that method without calling the event in tcheckcombobox.keydown first? Since that is the most immediate ancestor

--- End quote ---
isn't one of the problems of inheritance (and OOP)? maybe you want to try a different approach?!
Instead of trying to hack through the ancestor, simply copy/paste the existing implementation and modify the copy to your needs.

wp:

--- Quote from: Joanna on October 14, 2021, 07:24:37 am ---I’m trying to make the tcheckcombobox work better.

--- End quote ---

Joanna, just want to tell you that I am attempting to fix TCheckComboBox. The problem is the usage of platform-defines {$IF DEFINED(LCLWin32)) inside the LCL which is not allowed. I am following two ideas: either integrate the component into the LCL widgetset interface system, or move the component out of the LCL into a separate package, e.g. LazControls. ATM I am favouring the second approach which is much easier (however, breaks user code since projects must add LazControls to their requirements then).

Both ways will fix the buggy behaviour of the component with the dropdown in Windows.

But in order to improve usabilitiy of the component there are other issues to be solved:
- check/uncheck items only when the checkbox is clicked, not when the item is clicked somewhere else
- display a list of the checked items in the non-dropped case so that the user can see the checked item without having to drop down the combo.

howardpc:

--- Quote from: wp on October 14, 2021, 10:36:59 am ---But in order to improve usabilitiy of the component there are other issues to be solved:
- check/uncheck items only when the checkbox is clicked, not when the item is clicked somewhere else

--- End quote ---
Speaking only for myself, I rather like this feature that clicking anywhere on the text of the item toggles the checked status. But perhaps it flouts some GUI guidelines or widgetset protocol?

jamie:

--- Quote from: wp on October 14, 2021, 10:36:59 am ---
--- Quote from: Joanna on October 14, 2021, 07:24:37 am ---I’m trying to make the tcheckcombobox work better.

--- End quote ---

Joanna, just want to tell you that I am attempting to fix TCheckComboBox. The problem is the usage of platform-defines {$IF DEFINED(LCLWin32)) inside the LCL which is not allowed. I am following two ideas: either integrate the component into the LCL widgetset interface system, or move the component out of the LCL into a separate package, e.g. LazControls. ATM I am favouring the second approach which is much easier (however, breaks user code since projects must add LazControls to their requirements then).

Both ways will fix the buggy behaviour of the component with the dropdown in Windows.

But in order to improve usabilitiy of the component there are other issues to be solved:
- check/uncheck items only when the checkbox is clicked, not when the item is clicked somewhere else
- display a list of the checked items in the non-dropped case so that the user can see the checked item without having to drop down the combo.

--- End quote ---

 This is an old problem I addressed way back about the code using those defines which need to be added to the project for it to work.

 I made changes to the TComboboxEx and I guess the Check box also has the same issues which I didn't touch because I saw the Tcomboboxex just had way to much that needed correction.

 As for the defines I replaced them using the  MSWINDOWS instead which seems to be defined at the compiler level. It worked for but like I said the controls have other issues, too. Like the sorting will crash, auto complete does not work because real combobox isn't populated etc.

 Jonna can achieve what she needs better simply making her own using a ownerdraw...

Have a good day..


Navigation

[0] Message Index

[#] Next page

Go to full version