Bwidget Source Code
View Ticket
Not logged in
Ticket UUID: c847b2c68dfbf89453de19b2fcf341a02338ca82
Title: Add "::SelectColor::use" to pckIndex.tcl
Type: Bug Version: current
Submitter: oehhar Created on: 2025-06-24 18:44:15
Subsystem: bwidget 1.x Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-08-05 14:04:33
Resolution: Fixed Closed By: anonymous
    Closed on: 2025-08-05 14:04:33
Description:

This is an extraction from ticket [378209fe].

Quote: For BWidget knows the command "use" for SelectColor, please add in pkgInit.tcl the command "::SelectColor::use" right at the end of the definition list for it.

I tried this:

% SelectColor .s
% .s use
wrong # args: should be "::Dialog::use"

Error message is bogus. No command "use" found in SelectColor or Dialog documentation.

But in Widget::define, there is a comment that the use command is related to late loading. This is connected to pkgIndex.tcl.

User Comments: anonymous (claiming to be TWu) added on 2025-08-05 14:04:33:
Hello Harald,

to document why we got the "bogus" message, look at the beginning of source of SelectColor.
On line 2 we find "Widget::define SelectColor color Dialog".

Before the change the pseudo-class-mechanism try to call SelectColor::use,
which not exists and is not defined in the package to be created thru Widget::init.
So the next class (here Dialog) is requested.
It has no own definition (overwriting the Widget-base).
So the Widget::use is called with class "Dialog".
Unfortunately the class of .s (from our example above) is SelectColor and not Dialog!

After the change we claimed a "use" for SelectColor in the pkgIndex.tcl.
On initialization this proc is generated.
Now the same mechanism runs, calling the not overwritten SelectColor::use.
Not the Widget::use is called and not Dialog::use, but the own one with the right class of itself!
No error message any longer - and the "use" command resolves and
gives back the class hierarchy right.

Hope, this helps for the next problems...

All the best, Thomas W.

oehhar added on 2025-06-24 18:51:34:

Well, all other commands also have this, so lets add it with commit [a2ca981c04].

Thanks Thomas.

Bug closed

Harald