Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Different behavior of Tk program in two versions of Perl

by Anonymous Monk
on Jul 01, 2018 at 23:23 UTC ( [id://1217715]=note: print w/replies, xml ) Need Help??


in reply to Different behavior of Tk program in two versions of Perl

<h1> for the honor

What change in 5.26.2 (probably earlier?) results in this behavior?

Does it matter? The answer is no :)

The menu option “Sort and Filter” -> “Advanced sorting” can sort the list on up to 3 columns. It seems to work in both versions. In 5.16.3, the mask “Advanced sorting”, that is, a grid of three rows of BrowseEntry (to choose a column) and Checkbuttons (to define ascending or descending sorting) – this mask is empty on every new call. In 5.26.2, if I call the menu more times, some BrowseEntrys are set with the name of the first columns (not empty as the should). I can change the column choice or even delete an entry. However I cannot get why the entries are set just on call of the menu.

That is kind of difficult to read, anyway, see spoiler above (and notice its short),

but

With one click for a menu/submenu/popup/dropdown/checkbox ... thats too many clicks for simple sort.

A better idea is to use one of Tk::MListbox , Tk::Table, https://metacpan.org/pod/distribution/Tk-TableMatrix/pod/TableMatrix.pod, Sorted lists in Tk ... to sort you simply click on the column heading. one ascending, one descending, one no sorting*.

 

<h1> for the honor

2018-07-03 Athanasius removed <h1> tags

Replies are listed 'Best First'.
Re^2: Different behavior of Tk program in two versions of Perl
by vagabonding electron (Curate) on Jul 02, 2018 at 09:33 UTC

    Thank you very much for your reply! I am ageing but can still read well :-))

    Thank you for the hints to the other Tk modules too. I will certainly read the documentation.

    The posted "minimal example" is a part of a bigger application, I just did not change the menu portion here.

    The simple sort in the real application is actually performed per mouse click on the column header. The menu is for the advanced sort, that is on column1 then on column2 then on column3 (there are more than 3 columns in the real application too). This intention is not obvious with the short test file provided, I admit. I should make many Harrys with different dates to show that.

    Probably I did not describe the actual problem sufficiently. It is as follows. If I start the dialog where the user choose the columns to sort on, the entries should be empty. They are empty in v.5.16 but are partially set in v.5.26 and I do not understand why.

    Thanks again!

    Update: Just thought - probably your example behaves differently in v.5.16 and v.5.26 too? Cannot check it now (have only 5.16 here), will do it @home and report.

    Update 2: Now @home I run your example with v.5.16 and v.5.26 and I do see different behaviour. Whereas under v.5.16 the BrowseEntry always start with "inits", it starts sometimes with "inits" and sometimes with 1 under v.5.26 (I have to start skript more times in sequence to see this effect).

    So, first I learned that the minimal working example can be really small. :-) Thank you very much again, also for the hints about the other modules.

    Second, however, I see that this different behaviour is not just me. I would like to understand why. Is it something I should worry about?

    Update 3: I added two print statements to your example: print "Debug1: $init\n"; straight after $db->BrowseEntry(-variable, \$init, -choices, \@choices,)->pack; and print "Debug2: $init\n"; straight after $db->Show;. Under v.5.16 the output is always Debug1: inits for the first print statement and the chosen value for the second print statement. Unter v.5.26 the first print statement is sometimes Debug1: inits and sometimes Debug1: 1. The second print statement is the same way as under v.5.16. Still curious, why $init is set to the first value of @choices under v.5.26 and also not always but somehow randomly.

      Um. Does solution work for you (initialize variable from choices array with empty being the first )? Yes even with more columns it should still work by clicking header, thats as advanced as it needs to get :) i cant see a reason otherwise. Multiple dropdowns is definitely too laborious esp as number of columns increases. In the spirit of that approach would be a listbox with reorderable items where each item is a 3 radio buttons: asc desc ignore and label column header (and maybe uparrow button move item up in order...) Try both and see what makes more sense to you, i dont see extra popup clicks as advancement :)

        This is certainly worth trying, thank you very much for the idea.

      Second, however, I see that this different behaviour is not just me. I would like to understand why. Is it something I should worry about?

      dont worry about it use solution that provides consistent behaviour across all perl versions

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found