Ah - slowly I'm starting to understand the new (respective rather old) sayings...
(It seems I've missed it then, in 2014 )
With style=2 I can select as well as check different lines, both groups can be different.
If I see it right the selected lines have no meaning at all.
If it's this way: I can't understand it
And as when using style ^2 there's no check-(mark) but only selection, Don want's to interpret it different.
Hm...
As selections on style=2 don't seem to have any meaning - wouldn't it be helpful to tie checking and selection together - so that a click on line *or* checkmark checks and selects the line?
(OK: in that case the colour change for selection is not really neccessary )
Now the interpretation of style=2 or ^=2 can be identical. And both can be combined with =128.
Further: if style not 2, only one selection is allowed. Couldn't selection of a line in this case imply the OK?
(But that's independent from the text above.)
Maybe, in deepest logic, Don might find this a little bit strange.
But I think for the user it's just "as expected".
inputselect parent from tabbed list
Re: inputselect parent from tabbed list
Win11 Pro 223H2 Gerrman
Re: inputselect parent from tabbed list
Hi
After using tabbed list in inputselect box it became tiresome to make multiple selections.. searching for a name, I have to select name in list, delete search box, focus on item, find parents, click each, scroll some more find other parent...
So not I might go with the route of replacing all tabs with parent names, but I do not know how to do that.
Could someone help me with this please or at least give me an idea on how to go about doing this?
Read list as variable.
A
--B
----C
and make this out of it
A
A B
A B C
Thank you all for your help.
After using tabbed list in inputselect box it became tiresome to make multiple selections.. searching for a name, I have to select name in list, delete search box, focus on item, find parents, click each, scroll some more find other parent...
So not I might go with the route of replacing all tabs with parent names, but I do not know how to do that.
Could someone help me with this please or at least give me an idea on how to go about doing this?
Read list as variable.
A
--B
----C
and make this out of it
A
A B
A B C
Thank you all for your help.
Re: inputselect parent from tabbed list
I guess Sammay's wrapper from viewtopic.php?p=147965#p147965
includes what's necessary to accomplish this.
As an example (mine):
Leads to:
includes what's necessary to accomplish this.
As an example (mine):
Code: Select all
$items = <<<>>>
family
lastname
firstname
anothername
yetanother
friends
lastname
firstname
>>>;
$list = "";
$parent = "";
$lastLen = 0;
foreach($item, $items, <crlf>, "e") {
$len = strlen(regexmatches($item, "^\s+"));
$item = trim($item);
if !($len) {
$list = $list . $item . <crlf>;
$parent = $item . " ";
$lastLen = 0;
continue;
}
if ($len > $lastLen) {
$list = $list . $parent . $item . <crlf>;
$parent = $parent . $item . " ";
} elseif ($len < $lastLen) {
$parent = gettoken(trim($parent), -2, " ", , 1);
$list = $list . $parent . $item . <crlf>;
} else {
$list = $list . gettoken(trim($parent), -2, " ", , 1) . " " . $item . <crlf>;
}
$lastLen = $len;
}
text $list;
family
family lastname
family lastname firstname
family lastname anothername
family lastname yetanother
friends
friends lastname
friends lastname firstname
One of my scripts helped you out? Please donate via Paypal
Re: inputselect parent from tabbed list
thank you highend and my apologies I completely forgot about that. I could have looked at how it was done.
I greatly appreciate your help.
edit:
I found time to try your script and it worked great on the example list but I could not get it to work on list with tabs.
(or I might have been doing something wrong).
So I had to replace:
with:
$item = regexreplace($item, "^(\s+|\t+)*");
It worked well afterwards on the example list but once I inserted a nickname under a second name, or started doing other edits to the list, it failed to find the right parent.
I tried fixing it as much as I knew how so now it appears that works ok.
Thank you again for all your help.
Cheers
I greatly appreciate your help.
edit:
I found time to try your script and it worked great on the example list but I could not get it to work on list with tabs.
(or I might have been doing something wrong).
So I had to replace:
$item = trim($item);
with:
$item = regexreplace($item, "^(\s+|\t+)*");
It worked well afterwards on the example list but once I inserted a nickname under a second name, or started doing other edits to the list, it failed to find the right parent.
I tried fixing it as much as I knew how so now it appears that works ok.
Thank you again for all your help.
Cheers
Code: Select all
$list = <<<>>>
FFF
AAA
A1
B2
B3
B3a
B4
B5
B6
C1
C2
BBB
CCC
EE
DDD
RRR
GGG
VVV
>>>;
$tagList = "";
$parent = "";
$pattern = "^(\s+|\t+)*";
$lastLen = 0;
foreach($item, $list, <crlf>, "e") {
$len = strlen(regexmatches($item, $pattern));
$item = regexreplace($item, $pattern);
if !($len) {
$tagList = $tagList . $item . <crlf>;
$parent = $item . " ";
$lastLen = 0;
continue;
}
if ($len > $lastLen) {
$tagList = $tagList . $parent . $item . <crlf>;
$parent = $parent . $item . " ";
$lastLen = $lastLen+1;
}
elseif ($len == $lastLen) {
$parent = gettoken(trim($parent), -2, " ", , 1);
$tagList = $tagList . $parent . " " . $item . <crlf>;
$parent = $parent . " " . $item . " ";
}
elseif ($len < $lastLen) { //>>>
$parent = gettoken(trim($parent), "$len-$lastLen", " ", , 1);
$tagList = $tagList . $parent . " " . $item . <crlf>;
$parent = $parent . " " . $item . " ";
$lastLen = $lastLen-1;
}
}
text $tagList;
Re: inputselect parent from tabbed list
spoken too soon. not working properly if add more complex words with spaces.
like
edit:
Here is a new one but I have issues with "Dan" and "[his]"
When "Dan" is under "[hers]" all works good.
Once I move it one tab, put it under "[school name]" it does not correctly do names under "[his]"
What I am doing wrong here?
Looks like code thing converts tabs to spaces here... news to me but you are probably aware of it.
like
Code: Select all
lastname
-lastname firstname
-national park of whatever
Here is a new one but I have issues with "Dan" and "[his]"
When "Dan" is under "[hers]" all works good.
Once I move it one tab, put it under "[school name]" it does not correctly do names under "[his]"
What I am doing wrong here?
Looks like code thing converts tabs to spaces here... news to me but you are probably aware of it.
Code: Select all
$list = <<<>>>
FFF
AAA
A1
B2
B3
B3a HHH
B4
B5
B6
C1
C2
BBB
CCC
EE
DDD
[Friends]
[hers]
Tom
[school name]
Jane
Nickname
Jack
Kirk
{Blah}
Susie
Dan
[his]
Fluffy
Teacher
[Family]
[lastname]
lastname Mom
lastname Dad
lastname kid1
lastname kid2
>>>;
$tagList = "";
$parent = "";
$pattern = "^(\s+|\t+)*";
$lastLen = 0;
foreach($item, $list, <crlf>, "e") {
$len = strlen(regexmatches($item, $pattern));
$item = regexreplace($item, $pattern);
if !($len) {
$tagList = $tagList . $item . <crlf>;
$parent = $item . ",";
$lastLen = 0;
continue;
}
if ($len > $lastLen) {
$tagList = $tagList . $parent . $item . <crlf>;
$parent = $parent . $item . ",";
$lastLen = $lastLen+1;
}
elseif ($len == $lastLen) {
$parent = gettoken(trim($parent), -3, ",", , 1);
$tagList = $tagList . $parent . "," . $item . <crlf>;
$parent = $parent . "," . $item . ",";
$lastLen = $len;
}
elseif ($len < $lastLen) { //>>>
$parent = gettoken(trim($parent), "$len-$lastLen", ",", , 1);
$tagList = $tagList . $parent . "," . $item . <crlf>;
$parent = $parent . "," . $item . ",";
$lastLen = $lastLen-1;
}
}
$tagList = regexreplace(recase($tagList, "c"), ",", " ");
text $tagList;
Re: inputselect parent from tabbed list
Mine works fine on your list:
Code: Select all
$items = <<<>>>
FFF
AAA
A1
B2
B3
B3a HHH
B4
B5
B6
C1
C2
BBB
CCC
EE
DDD
[Friends]
[hers]
Tom
[school name]
Jane
Nickname
Jack
Kirk
{Blah}
Susie
Dan
[his]
Fluffy
Teacher
[Family]
[lastname]
lastname Mom
lastname Dad
lastname kid1
lastname kid2
>>>;
$indentLen = strlen(gettoken(regexmatches($items, "^[ \t]{1,}"), 1, "|"));
$list = "";
$parent = "";
$lastDepth = 0;
foreach($item, $items, <crlf>, "e") {
$curIndent = regexmatches($item, "^[ \t]{1,}");
$depth = ($curIndent != "") ? strlen($curIndent) / $indentLen : 0;
$item = trim($item, " <tab>");
if !($depth) {
$list = $list . $item . <crlf>;
$parent = $item . "|";
$lastDepth = 0;
continue;
}
if ($depth > $lastDepth) {
$list = $list . $parent . $item . <crlf>;
$parent = $parent . $item . "|";
} elseif ($depth < $lastDepth) {
$diff = $lastDepth - $depth;
$parent = gettoken(trim($parent, "|"), $depth, "|", , 1) . "|" . $item . "|";
$list = $list . $parent . <crlf>;
} else {
$parent = gettoken(trim($parent, "|"), $depth, "|", , 1) . "|" . $item . "|";
$list = $list . $parent . <crlf>;
}
$lastDepth = $depth;
}
$list = regexreplace($list, "\|", " ");
text $list;
One of my scripts helped you out? Please donate via Paypal
Re: inputselect parent from tabbed list
Beautiful, works as it should.
Thank you highend.
Thank you highend.