There is something to watch out for in HList selections. There is an "internal counter in HList" which increments the selection number of the list children. For instance, if you have 10 list entries, their list numbers will be 0-9. If you delete them, and make 10 new entries, the last entry number will now be 19.
So you have to test for the existence of the selection.
For example, I wanted to delete an entry, and then have the active selection move to the next entry. If the next entry dosn't exist, go to the previous entry.Well you may have already deleted the "previous internal number" and you will get "entry dosn't exist" if you just try to go to the previous(or next) number. So you need something along the line of this sub. It just gives you the idea.
sub{my $listnum =$h->info('selection');
$h->delete('entry',$h->info('selection'
+));
if($h->info('exists', $listnum + 1))
+{
$h->selectionSet($listnum + 1)
}else{
while($listnum--){
if($h->info('exists',$
+listnum)){
$h->selectionSet($
+listnum);last}
}
}
delete $info{$key_sel};
I'm not really a human, but I play one on earth.
flash japh
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.