Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

FACILITY REJECTED 100044200000;


devel / comp.lang.tcl / Help with a design decision

SubjectAuthor
* Help with a design decisionLuc
+- Re: Help with a design decisionChristian Gollwitzer
+* Re: Help with a design decisionRich
|`* Re: Help with a design decisionLuc
| +- Re: Help with a design decisionet99
| `* Re: Help with a design decisionRich
|  `* Re: Help with a design decisionLuc
|   +* Re: Help with a design decisionRich
|   |`* Re: Help with a design decisionLuc
|   | `* Re: Help with a design decisionbriang
|   |  `* Re: Help with a design decisionLuc
|   |   `* Re: Help with a design decisionlamuzz...@gmail.com
|   |    `* Re: Help with a design decisionLuc
|   |     `* Re: Help with a design decisionlamuzz...@gmail.com
|   |      `* Re: Help with a design decisionLuc
|   |       `- Re: Help with a design decisionlamuzz...@gmail.com
|   `* Re: Help with a design decisionSchelte
|    `- Re: Help with a design decisionLuc
`* Re: Help with a design decisionMole Cool
 `* Re: Help with a design decisionLuc
  `- Re: Help with a design decisionet99

1
Help with a design decision

<20230529154358.419c080d@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22147&group=comp.lang.tcl#22147

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Help with a design decision
Date: Mon, 29 May 2023 15:43:58 -0300
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <20230529154358.419c080d@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="cfefa8f643862450143fa04ed29ea918";
logging-data="1656203"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XsDZV0KDKYkiXoO4j78TyFuGme6ONPmc="
Cancel-Lock: sha1:WPSfEJpUJxBOsWghydx45z1ToAA=
 by: Luc - Mon, 29 May 2023 18:43 UTC

Gentle elders of the village, I come here to ask your wise guidance.

I am trying to make a file manager kind of application. After a few
headaches, I finally managed to upgrade tkdnd to the latest version,
and it's a game changer. Apparently, I can make any widget act as a
drop-and-drop source or target, and receive data from the outside
world too.

tkdnd::drop_target register $::dropbutton *
bind $::dropbutton <<Drop>> {tk_messageBox -message "YES"}

Good.

The problem is, I need more than "any widget." I have a widget with
a file list and I want each file in that list to be a source and each
directory to be both a source and a target.

I have made and am still working on two prototypes. One uses a text
widget to produce the file list. The other uses a treeview widget.
In the first case, each file or directory is in fact a line in a text
widget. In the second case, each file or directory is an "item" in a
tree that I don't know how to reference individually. So in either
case I don't know how to register or bind the individual file name,
which is a text widget's line or a treeview's item.

The best I could think of so far is to register the parent (text or
treeview) and drop the dragged data into whichever directory was
already selected before anything was ever clicked and dragged, but of
course that is pretty lame. The user should be able to drag something
into the application, hover over the directories to select one and
drop the something into the selected item.

Also note that I am going to implement an optional "Norton Commander"
view, which is two independent file listings side by side so you can
drag from one onto the other. So I really need to be able to drag and
drop individual items.

Now, I am beginning to consider using a canvas, which I admit is an
idea bred out of desperation. I really don't think a canvas is the
best tool for this job. But at least a canvas will give me full Tk
paths to reference the items.

O, gentle elders of the village, what is your wisdom?

--
Luc
>>

Re: Help with a design decision

<u531ft$1k7aj$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22148&group=comp.lang.tcl#22148

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: auriocus@gmx.de (Christian Gollwitzer)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Mon, 29 May 2023 22:21:17 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <u531ft$1k7aj$1@dont-email.me>
References: <20230529154358.419c080d@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 May 2023 20:21:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8ad5252d2fa0b045477bc99ec13f71db";
logging-data="1711443"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HgI+etoQArXa/CJ+ioh5vjX6KUwOn6L0="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.11.1
Cancel-Lock: sha1:pqIMmlcm5xlgTH5q0qOddbFQIHo=
In-Reply-To: <20230529154358.419c080d@lud1.home>
 by: Christian Gollwitzer - Mon, 29 May 2023 20:21 UTC

Am 29.05.23 um 20:43 schrieb Luc:
> Gentle elders of the village, I come here to ask your wise guidance.
>
> I am trying to make a file manager kind of application. After a few
> headaches, I finally managed to upgrade tkdnd to the latest version,
> and it's a game changer. Apparently, I can make any widget act as a
> drop-and-drop source or target, and receive data from the outside
> world too.
>
> tkdnd::drop_target register $::dropbutton *
> bind $::dropbutton <<Drop>> {tk_messageBox -message "YES"}
>
> Good.
>
> The problem is, I need more than "any widget." I have a widget with
> a file list and I want each file in that list to be a source and each
> directory to be both a source and a target.

Use tablelist. There is even a talk about how to use it:
https://www.youtube.com/watch?v=rUAfj3Syd_I

Christian

Re: Help with a design decision

<u53799$1ljd5$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22149&group=comp.lang.tcl#22149

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Mon, 29 May 2023 22:00:09 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <u53799$1ljd5$1@dont-email.me>
References: <20230529154358.419c080d@lud1.home>
Injection-Date: Mon, 29 May 2023 22:00:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c79e200e80a2b858e296b0dbf00f5cb5";
logging-data="1756581"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UG9tkOc+3Fg1KproGjgjv"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:wWGThMyoQgGjgamxm6XDjn+ZCI8=
 by: Rich - Mon, 29 May 2023 22:00 UTC

Luc <luc@sep.invalid> wrote:
> I am trying to make a file manager kind of application.
[snip]
>
> I have made and am still working on two prototypes. One uses a text
> widget to produce the file list. The other uses a treeview widget.
> In the first case, each file or directory is in fact a line in a text
> widget. In the second case, each file or directory is an "item" in a
> tree that I don't know how to reference individually. So in either
> case I don't know how to register or bind the individual file name,
> which is a text widget's line or a treeview's item.

Beyond Christian's suggestion, you need to read up on two things in the
manpages for the treeview and text widgets:

treeview tags, which are initially referenced in early in the manpage
this way:

Each item also has a list of tags, which can be used to associate
event bindings with individual items and control the appearance of
the item.

So, possibly, you can attach drag/drop bindings to treeview items using
the tags feature.

As to how to identify a treeview row, that is the "id" of the row.
This is also again documented in the manpage:

Each item is identified by a unique name. The widget will generate
item IDs if they are not supplied by the caller.

So you can either assign item ID's yourself, or just let the widget
assign them, and then use them to reference each.

For text widgets, the system works in a similar manner (via tags) for
assigning bindings. This is also documented in the text widget
manpage:

The second purpose for tags is event bindings. You can associate
bindings with a tag in much the same way you can associate bindings
with a widget class: whenever particular X events occur on
characters with the given tag, a given Tcl command will be executed.

So much like with the treeview, you'd assign tags to passages of the text
widget, and bind to those tags (presumably tkdnd can bind to text
tags).

And for the text widget, you have each line identified by "line number"
in the widget.

Re: Help with a design decision

<20230529212936.19a60736@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22150&group=comp.lang.tcl#22150

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Mon, 29 May 2023 21:29:36 -0300
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <20230529212936.19a60736@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="afce45a7ba244fd1ab3143cde40a82d8";
logging-data="1805234"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18O4LYV5NV3WGHLvPaqExX+30EgeE3FT2g="
Cancel-Lock: sha1:CN4wjCGT9WTxLUuoAuAuIygt3WU=
 by: Luc - Tue, 30 May 2023 00:29 UTC

On Mon, 29 May 2023 22:00:09 -0000 (UTC), Rich wrote:

> So much like with the treeview, you'd assign tags to passages of the text
> widget, and bind to those tags (presumably tkdnd can bind to text
> tags).

Sadly, no, it can't.

Remember this:

tkdnd::drop_target register $::dropbutton *
bind $::dropbutton <<Drop>> {tk_messageBox -message "YES"}

I suppose the second line would work if I could run the first one,
but I don't think I can. Do you?

I have tried, tkdnd will not accept a text widget tag as a "widget."

--
Luc
>>

Re: Help with a design decision

<u53hfq$1n7ep$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22151&group=comp.lang.tcl#22151

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et99@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Mon, 29 May 2023 17:54:18 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <u53hfq$1n7ep$1@dont-email.me>
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 30 May 2023 00:54:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c519c7c96e6735cdc2229b169d5179fb";
logging-data="1809881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dgQsCx9c09K0iw7l1mrT0"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:O1t8oG6ppRWVsH2LH7LhquBrqv4=
In-Reply-To: <20230529212936.19a60736@lud1.home>
Content-Language: en-US
 by: et99 - Tue, 30 May 2023 00:54 UTC

On 5/29/2023 5:29 PM, Luc wrote:
> On Mon, 29 May 2023 22:00:09 -0000 (UTC), Rich wrote:
>
>> So much like with the treeview, you'd assign tags to passages of the text
>> widget, and bind to those tags (presumably tkdnd can bind to text
>> tags).
>
> Sadly, no, it can't.
>
> Remember this:
>
> tkdnd::drop_target register $::dropbutton *
> bind $::dropbutton <<Drop>> {tk_messageBox -message "YES"}
>
> I suppose the second line would work if I could run the first one,
> but I don't think I can. Do you?
>
> I have tried, tkdnd will not accept a text widget tag as a "widget."
>
>

I've only ever played with the demo of treectrl, but it looks like
a rather complex and powerful gui toolkit. I doubt it would be
directly compatible with tkdnd, but it appears to have its own
drag/drop internally.

It's available with the magicsplat distro which is where I've
run the demo. Otherwise,

https://tktreectrl.sourceforge.net/

Re: Help with a design decision

<u53nbj$1rj5g$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22152&group=comp.lang.tcl#22152

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Tue, 30 May 2023 02:34:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <u53nbj$1rj5g$1@dont-email.me>
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me> <20230529212936.19a60736@lud1.home>
Injection-Date: Tue, 30 May 2023 02:34:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c79e200e80a2b858e296b0dbf00f5cb5";
logging-data="1952944"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+SwGhXfaTBfnIlHGdYf4nv"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:dMLYIBKYamXpQGYrYbbqt5nn1E0=
 by: Rich - Tue, 30 May 2023 02:34 UTC

Luc <luc@sep.invalid> wrote:
> On Mon, 29 May 2023 22:00:09 -0000 (UTC), Rich wrote:
>
>> So much like with the treeview, you'd assign tags to passages of the text
>> widget, and bind to those tags (presumably tkdnd can bind to text
>> tags).
>
> Sadly, no, it can't.
>
> Remember this:
>
> tkdnd::drop_target register $::dropbutton *
> bind $::dropbutton <<Drop>> {tk_messageBox -message "YES"}
>
> I suppose the second line would work if I could run the first one,
> but I don't think I can. Do you?
>
> I have tried, tkdnd will not accept a text widget tag as a "widget."

And was that all you tried? I've never used tkdnd, so the following is
based on just looking over the tkdnd manpage now, but it seems you
could, for either a text or a treeview, do:

First setup the window (the text or the treeview) as the "drop target"
(this satisifes the need for tkdnd::drop_target to register an actual
widget).

Then setup bindings on the tkdnd events, attached to the window itself,
to trigger procs for each event. For <<DropPosition>> use the %X and
%Y expansions to obtain the x,y coordinate of the mouse over the
window. Then using the normal method calls for the widget (be it text
or treeview) convert the x,y mouse position into a text line number or
a treeview item id value (and decide if the drop "type" is appropriate
for this x,y value and return the appropriate return value).

Re: Help with a design decision

<1e10413e-cc97-4ec8-a778-2c67f988a418n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22155&group=comp.lang.tcl#22155

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:c4d:b0:75c:abd3:74ea with SMTP id u13-20020a05620a0c4d00b0075cabd374eamr468847qki.13.1685443317676;
Tue, 30 May 2023 03:41:57 -0700 (PDT)
X-Received: by 2002:a05:620a:4408:b0:75c:9b66:d00e with SMTP id
v8-20020a05620a440800b0075c9b66d00emr484983qkp.1.1685443317314; Tue, 30 May
2023 03:41:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 30 May 2023 03:41:56 -0700 (PDT)
In-Reply-To: <20230529154358.419c080d@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:ee:974c:4800:4464:964d:bd46:d24d;
posting-account=IpC1pwoAAACCAmF-qbg4PWxvUAd-j7Tc
NNTP-Posting-Host: 2003:ee:974c:4800:4464:964d:bd46:d24d
References: <20230529154358.419c080d@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1e10413e-cc97-4ec8-a778-2c67f988a418n@googlegroups.com>
Subject: Re: Help with a design decision
From: molecool1058@googlemail.com (Mole Cool)
Injection-Date: Tue, 30 May 2023 10:41:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mole Cool - Tue, 30 May 2023 10:41 UTC

I use most of the time (> 95%) tk treectrl, it has a lot of cool features, see the about 30 demos included. There is a explorer demo as well, and a couple with drag and drop.

But like most of this binary packages, they will probably die with Tcl 9.0 and no longer loadable.

Re: Help with a design decision

<20230530201343.73d41884@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22157&group=comp.lang.tcl#22157

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Tue, 30 May 2023 20:13:43 -0300
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <20230530201343.73d41884@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<1e10413e-cc97-4ec8-a778-2c67f988a418n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="db6d28c3f0fffb1cd5d1c0ae2683d4b1";
logging-data="2249913"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Z0OSLnXo0mS1+toCxpgAq8vbhZfGQPUs="
Cancel-Lock: sha1:IrTM/GfeK9HHQo92x3akN5h6Z6o=
 by: Luc - Tue, 30 May 2023 23:13 UTC

On Tue, 30 May 2023 03:41:56 -0700 (PDT), Mole Cool wrote:

> But like most of this binary packages, they will probably die with Tcl
> 9.0 and no longer loadable.

Then I will cling to Tcl 8.6 for at least 10 years before I jump to Tcl 9.
Come and pry it away from my cold stiff dead hands.

--
Luc
>>

Re: Help with a design decision

<20230530213832.0dad2d87@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22158&group=comp.lang.tcl#22158

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Tue, 30 May 2023 21:38:32 -0300
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <20230530213832.0dad2d87@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
<u53nbj$1rj5g$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="db6d28c3f0fffb1cd5d1c0ae2683d4b1";
logging-data="2268792"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//l7Y4v3H6Y126flhY+7vuEa4uKBO2tgo="
Cancel-Lock: sha1:wfKw74iDqlRAfIdUAGIVxRUGsvY=
 by: Luc - Wed, 31 May 2023 00:38 UTC

On Tue, 30 May 2023 02:34:27 -0000 (UTC), Rich wrote:

> First setup the window (the text or the treeview) as the "drop target"
> (this satisifes the need for tkdnd::drop_target to register an actual
> widget).
>
> Then setup bindings on the tkdnd events, attached to the window itself,
> to trigger procs for each event. For <<DropPosition>> use the %X and
> %Y expansions to obtain the x,y coordinate of the mouse over the
> window. Then using the normal method calls for the widget (be it text
> or treeview) convert the x,y mouse position into a text line number or
> a treeview item id value (and decide if the drop "type" is appropriate
> for this x,y value and return the appropriate return value).

Clever mechanism for targets.

Now, how would you turn a text line into a drag-and-drop source?

How would one be able to drag a text widget line onto something else?

--
Luc
>>

Re: Help with a design decision

<u568em$297kf$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22159&group=comp.lang.tcl#22159

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Wed, 31 May 2023 01:38:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <u568em$297kf$1@dont-email.me>
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me> <20230529212936.19a60736@lud1.home> <u53nbj$1rj5g$1@dont-email.me> <20230530213832.0dad2d87@lud1.home>
Injection-Date: Wed, 31 May 2023 01:38:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="46fe39ceb088fa7db40dbb1f93904012";
logging-data="2399887"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5PusLsMHfJoPQjmrev5bZ"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:gYnxGo2sbuHVFvLQAysbZ9FQrO0=
 by: Rich - Wed, 31 May 2023 01:38 UTC

Luc <luc@sep.invalid> wrote:
> On Tue, 30 May 2023 02:34:27 -0000 (UTC), Rich wrote:
>
>> First setup the window (the text or the treeview) as the "drop
>> target" (this satisifes the need for tkdnd::drop_target to register
>> an actual widget).
>>
>> Then setup bindings on the tkdnd events, attached to the window
>> itself, to trigger procs for each event. For <<DropPosition>> use
>> the %X and %Y expansions to obtain the x,y coordinate of the mouse
>> over the window. Then using the normal method calls for the widget
>> (be it text or treeview) convert the x,y mouse position into a text
>> line number or a treeview item id value (and decide if the drop
>> "type" is appropriate for this x,y value and return the appropriate
>> return value).
>
>
> Clever mechanism for targets.
>
> Now, how would you turn a text line into a drag-and-drop source?

Presumably the same way you'd otherwise make a text line "active" for
mousing, apply a text tag to the characters that should be "active" and
bind to the appropriate events to be a drag. Which most likely would
mean detecting the line on a button down event, then beginning the
"drop source" aspects upon motion (possibly upon sufficient motion
distance to avoid small mouse jitters of 2-3 pixels initiating a drag).

> How would one be able to drag a text widget line onto something else?

Same way, apply tags, bind appropriate events to those tags to initiate
the drag -- then insert into the drag whatever is data appropriate for
"dragging" of this text line.

Re: Help with a design decision

<20230530225734.1f331069@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22160&group=comp.lang.tcl#22160

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Tue, 30 May 2023 22:57:34 -0300
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <20230530225734.1f331069@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
<u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home>
<u568em$297kf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="db6d28c3f0fffb1cd5d1c0ae2683d4b1";
logging-data="2401896"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gBMO7B8KrjgxGG8G4e0wK51obhKldBhM="
Cancel-Lock: sha1:NAEHGU/auY0UPdNdrEkn9sPpzwM=
 by: Luc - Wed, 31 May 2023 01:57 UTC

On Wed, 31 May 2023 01:38:30 -0000 (UTC), Rich wrote:

> > Clever mechanism for targets.
> > Now, how would you turn a text line into a drag-and-drop source?
> Presumably the same way you'd otherwise make a text line "active" for
> mousing, apply a text tag to the characters that should be "active" and
> bind to the appropriate events to be a drag. Which most likely would
> mean detecting the line on a button down event, then beginning the
> "drop source" aspects upon motion (possibly upon sufficient motion
> distance to avoid small mouse jitters of 2-3 pixels initiating a drag).
>
> > How would one be able to drag a text widget line onto something else?
>
> Same way, apply tags, bind appropriate events to those tags to initiate
> the drag -- then insert into the drag whatever is data appropriate for
> "dragging" of this text line.

You bring up tags again, but tags don't work with tkdnd. They don't work
with the 'register' command that turns a widget into a source (or target)
because a "tagged" line of text is not a widget.

I am having a busy week so I didn't have much time to code today, but
I have done some more prototyping and now I think that my best bet
will be labels in place of text lines. They can be fully referenced
as widgets. They *are* bona fide widgets. I'm just not too sure about
what parent widget I should use to contain them. Maybe a text widget,
but I guess I will have to experiment.

I still don't know how to turn treeview items (the left hand panel)
into drag-and-drop sources (same problem as with text), but I guess
that is a lot less likely to be missed or wanted by anyone.

--
Luc
>>

Re: Help with a design decision

<u56c31$29iho$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22161&group=comp.lang.tcl#22161

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et99@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Tue, 30 May 2023 19:40:33 -0700
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <u56c31$29iho$1@dont-email.me>
References: <20230529154358.419c080d@lud1.home>
<1e10413e-cc97-4ec8-a778-2c67f988a418n@googlegroups.com>
<20230530201343.73d41884@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 31 May 2023 02:40:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5bcac4e79e0bb04be529e78379c56086";
logging-data="2411064"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bc6kdvaVYJjneHynHKS4K"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:EPS9XQkcZv1LAhUXrpoM9lc+KGk=
In-Reply-To: <20230530201343.73d41884@lud1.home>
Content-Language: en-US
 by: et99 - Wed, 31 May 2023 02:40 UTC

On 5/30/2023 4:13 PM, Luc wrote:
> On Tue, 30 May 2023 03:41:56 -0700 (PDT), Mole Cool wrote:
>
>> But like most of this binary packages, they will probably die with Tcl
>> 9.0 and no longer loadable.
>
>
> Then I will cling to Tcl 8.6 for at least 10 years before I jump to Tcl 9.
> Come and pry it away from my cold stiff dead hands.
>
>

This is where starpak's come in handy. For example,
although I run a 64 bit windows 10 system, I have a
version of BLT that can only run in a 32 bit tcl/tk.

I installed MagicSplat 32bit 8.6.9 in a 32 bit VM and
then copied the lib directory packages into the lib
directory of my starpak folder and built the pak using
an Ashok 8.6.9 32bit tclkit as the -runtime arg.

The resulting single file .exe is 24megs - tiny
considering it has all the 32bit MagicSplat packages
built in.

% package require treectrl
2.4.3
% package require BLT
2.4
% package require twapi
4.3.5
% package require tkdnd
2.9
% info nameof
C:/tclf/kits/tcl869-twapi-blt-magic.exe
% info pa
8.6.9
% parray tcl_platform
....
tcl_platform(osVersion) = 10.0
tcl_platform(platform) = windows
tcl_platform(pointerSize) = 4
tcl_platform(threaded) = 1

Meanwhile, I also have a MagicSplat 64 distro installed
which runs 8.6.13.

Re: Help with a design decision

<bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22162&group=comp.lang.tcl#22162

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:11cd:b0:3f7:736c:9013 with SMTP id n13-20020a05622a11cd00b003f7736c9013mr1864824qtk.6.1685576684908;
Wed, 31 May 2023 16:44:44 -0700 (PDT)
X-Received: by 2002:a05:622a:54e:b0:3f4:dfbd:820c with SMTP id
m14-20020a05622a054e00b003f4dfbd820cmr1951903qtx.4.1685576684661; Wed, 31 May
2023 16:44:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 31 May 2023 16:44:44 -0700 (PDT)
In-Reply-To: <20230530225734.1f331069@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=192.183.219.24; posting-account=f4QznQoAAAAjupLEpV87s_G-96g1Io1w
NNTP-Posting-Host: 192.183.219.24
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home> <u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home> <u568em$297kf$1@dont-email.me> <20230530225734.1f331069@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>
Subject: Re: Help with a design decision
From: bgriffinfortytwo@gmail.com (briang)
Injection-Date: Wed, 31 May 2023 23:44:44 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: briang - Wed, 31 May 2023 23:44 UTC

On Tuesday, May 30, 2023 at 6:57:40 PM UTC-7, Luc wrote:
> On Wed, 31 May 2023 01:38:30 -0000 (UTC), Rich wrote:
>
> > > Clever mechanism for targets.
> > > Now, how would you turn a text line into a drag-and-drop source?
>
> > Presumably the same way you'd otherwise make a text line "active" for
> > mousing, apply a text tag to the characters that should be "active" and
> > bind to the appropriate events to be a drag. Which most likely would
> > mean detecting the line on a button down event, then beginning the
> > "drop source" aspects upon motion (possibly upon sufficient motion
> > distance to avoid small mouse jitters of 2-3 pixels initiating a drag).
> >
> > > How would one be able to drag a text widget line onto something else?
> >
> > Same way, apply tags, bind appropriate events to those tags to initiate
> > the drag -- then insert into the drag whatever is data appropriate for
> > "dragging" of this text line.
> You bring up tags again, but tags don't work with tkdnd. They don't work
> with the 'register' command that turns a widget into a source (or target)
> because a "tagged" line of text is not a widget.
>
>
> I am having a busy week so I didn't have much time to code today, but
> I have done some more prototyping and now I think that my best bet
> will be labels in place of text lines. They can be fully referenced
> as widgets. They *are* bona fide widgets. I'm just not too sure about
> what parent widget I should use to contain them. Maybe a text widget,
> but I guess I will have to experiment.

Hi Luc. I don't have time to experiment, so I don't know if this will work, but you might give it a try:
Use the textwidget dlineinfo call to get the size information of the tagged text. Then use the textwidget peer call to create a peer textwidget. Resize the peer widget according to the dlineinfo. Use this peer widget for the dragging. Afterwords, destroy the peer widget.

-Brian

Re: Help with a design decision

<20230531224123.66e0bf31@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22163&group=comp.lang.tcl#22163

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Wed, 31 May 2023 22:41:23 -0300
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <20230531224123.66e0bf31@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
<u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home>
<u568em$297kf$1@dont-email.me>
<20230530225734.1f331069@lud1.home>
<bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="a4566afe11b8946f799f7c0e74017743";
logging-data="2814858"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5PaIqXpNJcVI+GxoZcpBU2VzLReXhkdk="
Cancel-Lock: sha1:oUobtMsdQryXNABPzZ4GuuSbqHw=
 by: Luc - Thu, 1 Jun 2023 01:41 UTC

On Wed, 31 May 2023 16:44:44 -0700 (PDT), briang wrote:

> Hi Luc. I don't have time to experiment, so I don't know if this will
> work, but you might give it a try: Use the textwidget dlineinfo call to
> get the size information of the tagged text. Then use the textwidget peer
> call to create a peer textwidget. Resize the peer widget according to
> the dlineinfo. Use this peer widget for the dragging. Afterwords,
> destroy the peer widget.
>
> -Brian

Very interesting idea. I will certainly look into it on the weekend.

Thank you.

--
Luc
>>

Re: Help with a design decision

<a7a5b67f-b4db-4da2-b71b-82ee513e9943n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22164&group=comp.lang.tcl#22164

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:44d0:b0:74e:37dd:6197 with SMTP id y16-20020a05620a44d000b0074e37dd6197mr2436324qkp.8.1685587169450;
Wed, 31 May 2023 19:39:29 -0700 (PDT)
X-Received: by 2002:a05:620a:29d2:b0:75b:12fe:8a95 with SMTP id
s18-20020a05620a29d200b0075b12fe8a95mr2223887qkp.4.1685587169187; Wed, 31 May
2023 19:39:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 31 May 2023 19:39:28 -0700 (PDT)
In-Reply-To: <20230531224123.66e0bf31@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=190.139.63.124; posting-account=Cgy5dQoAAADca6APzXXyHNx6hvwj5mk6
NNTP-Posting-Host: 190.139.63.124
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home> <u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home> <u568em$297kf$1@dont-email.me>
<20230530225734.1f331069@lud1.home> <bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>
<20230531224123.66e0bf31@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a7a5b67f-b4db-4da2-b71b-82ee513e9943n@googlegroups.com>
Subject: Re: Help with a design decision
From: lamuzzachiodi@gmail.com (lamuzz...@gmail.com)
Injection-Date: Thu, 01 Jun 2023 02:39:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1772
 by: lamuzz...@gmail.com - Thu, 1 Jun 2023 02:39 UTC

Maybe something more "simple" can be useful for you.
For example, take a look to "A simple DnD implementation by SES" (at end of https://wiki.tcl-lang.org/page/Drag+and+Drop).
Or, in the same line "simplednd" by Kevin Walzer (https://wiki.tcl-lang.org/page/SimpleDND).
This last isn't available but if you have interest i can paste the code here.

Saludos,

Alejandro

Re: Help with a design decision

<20230601134832.05b0b3e7@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22180&group=comp.lang.tcl#22180

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Thu, 1 Jun 2023 13:48:32 -0300
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20230601134832.05b0b3e7@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
<u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home>
<u568em$297kf$1@dont-email.me>
<20230530225734.1f331069@lud1.home>
<bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>
<20230531224123.66e0bf31@lud1.home>
<a7a5b67f-b4db-4da2-b71b-82ee513e9943n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="82d52d999216c2887d8f6fd90b1daed2";
logging-data="2992089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fUZLOX2gwc6MjlIWV7q7iy0I6yWoTkOw="
Cancel-Lock: sha1:OZDWFi6mQ5Wdogo1yknkGvt+dIg=
 by: Luc - Thu, 1 Jun 2023 16:48 UTC

On Wed, 31 May 2023 19:39:28 -0700 (PDT), lamuzz...@gmail.com wrote:

> Maybe something more "simple" can be useful for you.
> For example, take a look to "A simple DnD implementation by SES" (at end
> of https://wiki.tcl-lang.org/page/Drag+and+Drop).

I have been through that page and probably all links in it.

"A simple DnD implementation by SES" is bad. Try dragging 'a' down
towards the bottom then into the other pane, you'll see that 'e'
gets copied instead of 'a'.

> Or, in the same line
> "simplednd" by Kevin Walzer (https://wiki.tcl-lang.org/page/SimpleDND).
> This last isn't available but if you have interest i can paste the code
> here.

Yes, I am very interested. Thank you in advance.

--
Luc
>>

Re: Help with a design decision

<64df6a56-806f-44b6-84e7-d7b204112f79n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22184&group=comp.lang.tcl#22184

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:19a9:b0:3f6:b556:7c9a with SMTP id u41-20020a05622a19a900b003f6b5567c9amr2696656qtc.7.1685656898018;
Thu, 01 Jun 2023 15:01:38 -0700 (PDT)
X-Received: by 2002:ad4:5885:0:b0:626:14a2:cca6 with SMTP id
dz5-20020ad45885000000b0062614a2cca6mr1471999qvb.5.1685656897005; Thu, 01 Jun
2023 15:01:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 1 Jun 2023 15:01:36 -0700 (PDT)
In-Reply-To: <20230601134832.05b0b3e7@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=190.139.63.124; posting-account=Cgy5dQoAAADca6APzXXyHNx6hvwj5mk6
NNTP-Posting-Host: 190.139.63.124
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home> <u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home> <u568em$297kf$1@dont-email.me>
<20230530225734.1f331069@lud1.home> <bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>
<20230531224123.66e0bf31@lud1.home> <a7a5b67f-b4db-4da2-b71b-82ee513e9943n@googlegroups.com>
<20230601134832.05b0b3e7@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <64df6a56-806f-44b6-84e7-d7b204112f79n@googlegroups.com>
Subject: Re: Help with a design decision
From: lamuzzachiodi@gmail.com (lamuzz...@gmail.com)
Injection-Date: Thu, 01 Jun 2023 22:01:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 9903
 by: lamuzz...@gmail.com - Thu, 1 Jun 2023 22:01 UTC

Well, below i paste the code of simplednd by Kevin Walzer.
First, you must save this as "simplednd.tcl".

##simplednd: implements simple mechanism for drag-and-drop within Tk applications. (c) 2009 WordTech Communications LLC. License: standard Tcl license, http://www.tcl.tk/software/tcltk/license.html.

package provide simplednd 1.1
namespace eval simplednd {
#create the drag icon with empty text and image to initialize; then hide the icon
proc makeDragIcon {txt img} {
variable dragicon
variable dragtext
variable dragimage
#create the icon
set dragicon [toplevel .dnd]
set dragtext $txt
set dragimage $img
wm overrideredirect $dragicon true
label $dragicon.view -image $dragimage -text $dragtext -compound left
pack $dragicon.view
#now hide the icon
wm withdraw $dragicon
}
#register widget to respond to drag events: widget to register, its target widget, callback to associate with this drag event, text for the drag label, and image for the drag label
proc dragRegister {w target dragcmd dropcmd} {
variable dragicon
variable dragtext
variable dragimage
variable targetdirection
catch {simplednd::makeDragIcon {} {}}
puts "$w registered as dragsite with $target as the drop target"
#binding for when drag motion begins
bind $w <B1-Motion> [list [namespace current]::dragMove %W %X %Y $dragcmd $target]
#binding for when drop event occurs
bind $w <ButtonRelease-1> [list [namespace current]::dragStop %W %X %Y $target $dropcmd ]
}
#drag motion with following args: source widget, cursor x position, cursor y position, drag command, target widget
proc dragMove {w x y dragcmd target} {
variable dragicon
variable dragtext
variable dragimage
variable targetdirection
#the dragcmd properly configures the drag icon
eval $dragcmd
#configure drag icon with customized text and image
$dragicon.view configure -text $dragtext -image $dragimage
#dragicon appears
wm deiconify $dragicon
catch {raise $dragicon}
#this places the drag icon below the cursor
set x [expr {$x - ([winfo reqwidth $dragicon] / 2) }]
set y [expr {$y - [winfo reqheight $dragicon] + 25 }]
wm geometry $dragicon +$x+$y
[namespace current]::trackCursor $w $x $y $target
}
#track the cursor, change if it is over the drop target; args are source widget (w), x pos (x), y pos (y), target widget (target)
proc trackCursor {w x y target} {
#get the coordinates of the drop target
set targetx [winfo rootx $target]
set targety [winfo rooty $target]
set targetwidth [expr [winfo width $target] + $targetx]
set targetheight [expr [winfo height $target] + $targety]
#change the icon if over the drop target
if {($x > $targetx) && ($x < $targetwidth) && ($y > $targety) && ($y < $targetheight)} {
$w configure -cursor based_arrow_down
} else {
$w configure -cursor dot
}
}
#dragstop/drop event with following args: source widget, cursor x position, cursor y position, target widget, dropcommand: if over drop target, execute dropcommand; otherwise simply return
proc dragStop {w x y target dropcmd} {
variable dragicon
variable dragtext
variable dragimage
variable targetdirection
#hide dragicon on drop event
wm withdraw $dragicon
#change cursor back to arrow
$w configure -cursor arrow
#execute callback or simply return
if {[winfo containing $x $y] != $target} {
puts "target $w not reached"
} else {
focus -force $target
eval $dropcmd
}
}
#demo package
proc demo {} {
variable dragicon
variable dragtext
variable dragimage
#create image for demo
image create photo dnd_demo -data {R0lGODlhEAAQALMAAAAAAMbGxv//////////////////////////////////\
/////////////////////yH5BAEAAAEALAAAAAAQABAAAAQwMMhJ6wQ4YyuB\
+OBmeeDnAWNpZhWpmu0bxrKAUu57X7VNy7tOLxjIqYiapIjDbDYjADs=}
listbox .l -selectmode single -activestyle none
listbox .b -selectmode single -activestyle none
foreach item {do re mi} {
.l insert end $item
}
foreach item {fa so la} {
.b insert end $item
}
pack .l -side left
pack .b -side right
#register drag sources, drag targets, and callbacks
dragRegister .l .b [namespace current]::drag_l [namespace current]::drop_l
dragRegister .b .l [namespace current]::drag_b [namespace current]::drop_b
}
#dragcommand for demo l widget: configures dragicon
proc drag_l {} {
variable dragicon
variable dragtext
variable dragimage
set item [lindex [.l get [.l curselection]]]
set dragtext $item
set dragimage dnd_demo
}
#dropcommand for demo l widget: callback to execute on drop
proc drop_l {} {
variable dragicon
variable dragtext
variable dragimage
.b insert end $dragtext
.l delete [.l curselection]
}
#dragcommand for demo b widget: configures dragicon
proc drag_b {} {
variable dragicon
variable dragtext
variable dragimage
set item [lindex [.b get [.b curselection]]]
set dragtext $item
set dragimage dnd_demo
}
#dropcommand for demo b widget: callback to execute on drop
proc drop_b {} {
variable dragicon
variable dragtext
variable dragimage
.l insert end $dragtext
.b delete [.b curselection]
}
namespace export *
}

Now, save this as "pkgIndex.tcl"

# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded simplednd 1.1 [list source [file join $dir simplednd.tcl]]

Finally, the help :

The simpleDND Package

The simpleDND package implements a lightweight mechanism for drag-and-drop operations within a single Tcl/Tk application. When used, it provides a visual icon and cursor change to indicate a dragged object, and can execute any Tcl command upon a successful drop operation. The package is designed to be easy-to-use, with just a few commands required to add drag-and-drop. Any widget can be registered as a drag source or drop target.

simpleDND is called via package require simpleDND. It is implemented with the following command:
* proc dragRegister {w target dragcmd dropcmd}: w is the source widget where the drag is initiated, target is the target widget where the drop is completed, dragcmd is the Tcl command that is executed on the start of the drag operation, and dropcmd is the Tcl command that is executed when the drop operation is completed.
simplednd::dragRegister must be called for each widget that is set up as a drag source. For instance, if you have a listbox .l and a listbox .b that are both drag sources, the command must be called for each widget. Also, if listbox .l and listbox .b have multiple drop targets, then the command must be called for each drop target.

The dragcmd should be used to configure the drag icon. The variables ::simplednd::dragtext and ::simplednd::dragimg are used for this purpose. At a minimum, you must define a single command setting default values for the dragtext and dragimg variables, or you can provide a different command for each drag operation. simpleDND does not provide default values for the text or image in the drag icon; without at least one dragcmd, you will be dragging around an empty label as the drag icon.

The dropcmd is called on a successful drop, i.e. when the button is released over the drop target registered with the drag source. If the button is released over a widget that is not registered as the drop target, the cursor changes to a standard arrow and the drag icon disappears.

A demonstration of simpleDND is included with the package. Call simplednd::demo after loading the package. You can also inspect the demo source code for ideas on how to implement simpleDND in your own applications.

Ok, that's all.
I hope this help you.

Alejandro

Re: Help with a design decision

<20230602142225.0b06e38d@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22187&group=comp.lang.tcl#22187

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Fri, 2 Jun 2023 14:22:25 -0300
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <20230602142225.0b06e38d@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
<u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home>
<u568em$297kf$1@dont-email.me>
<20230530225734.1f331069@lud1.home>
<bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com>
<20230531224123.66e0bf31@lud1.home>
<a7a5b67f-b4db-4da2-b71b-82ee513e9943n@googlegroups.com>
<20230601134832.05b0b3e7@lud1.home>
<64df6a56-806f-44b6-84e7-d7b204112f79n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="9ab559f7d9bd94a03abc3e19b56dcdcb";
logging-data="3418592"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19t9jDVuUPE/OnUcE3M98R5orEivgGuqR8="
Cancel-Lock: sha1:Mw77mfza+LaU7jwJdDjf/S7FKTA=
 by: Luc - Fri, 2 Jun 2023 17:22 UTC

On Thu, 1 Jun 2023 15:01:36 -0700 (PDT), lamuzz...@gmail.com wrote:

> Well, below i paste the code of simplednd by Kevin Walzer.
> First, you must save this as "simplednd.tcl".

Thank you for the code.

Question for everybody: do you think it would be rude or otherwise
wrong to post this code in its corresponding page on the wiki, that
is currently empty except for a broken link?

--
Luc
>>

Re: Help with a design decision

<738cab6d-a999-4ea8-8ef2-ae160f88ec46n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22204&group=comp.lang.tcl#22204

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ad4:4e6d:0:b0:626:2413:900e with SMTP id ec13-20020ad44e6d000000b006262413900emr58009qvb.4.1686006057270; Mon, 05 Jun 2023 16:00:57 -0700 (PDT)
X-Received: by 2002:a05:620a:2807:b0:759:5252:c053 with SMTP id f7-20020a05620a280700b007595252c053mr72729qkp.1.1686006056967; Mon, 05 Jun 2023 16:00:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.11.MISMATCH!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Mon, 5 Jun 2023 16:00:56 -0700 (PDT)
In-Reply-To: <20230602142225.0b06e38d@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=190.139.63.124; posting-account=Cgy5dQoAAADca6APzXXyHNx6hvwj5mk6
NNTP-Posting-Host: 190.139.63.124
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me> <20230529212936.19a60736@lud1.home> <u53nbj$1rj5g$1@dont-email.me> <20230530213832.0dad2d87@lud1.home> <u568em$297kf$1@dont-email.me> <20230530225734.1f331069@lud1.home> <bc82af47-94f0-4d3b-bb2b-28b90e2e905en@googlegroups.com> <20230531224123.66e0bf31@lud1.home> <a7a5b67f-b4db-4da2-b71b-82ee513e9943n@googlegroups.com> <20230601134832.05b0b3e7@lud1.home> <64df6a56-806f-44b6-84e7-d7b204112f79n@googlegroups.com> <20230602142225.0b06e38d@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <738cab6d-a999-4ea8-8ef2-ae160f88ec46n@googlegroups.com>
Subject: Re: Help with a design decision
From: lamuzzachiodi@gmail.com (lamuzz...@gmail.com)
Injection-Date: Mon, 05 Jun 2023 23:00:57 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 3
 by: lamuzz...@gmail.com - Mon, 5 Jun 2023 23:00 UTC

I guess if this code is still useful, no one will be bothered by posting it.
Just my opinion ... ;-)

Alejandro

Re: Help with a design decision

<nnd$2c57727c$7c84c548@6791c3dcf0bc34d2>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22268&group=comp.lang.tcl#22268

  copy link   Newsgroups: comp.lang.tcl
Date: Sun, 11 Jun 2023 14:59:10 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
Subject: Re: Help with a design decision
Content-Language: en-US
Newsgroups: comp.lang.tcl
References: <20230529154358.419c080d@lud1.home> <u53799$1ljd5$1@dont-email.me> <20230529212936.19a60736@lud1.home> <u53nbj$1rj5g$1@dont-email.me> <20230530213832.0dad2d87@lud1.home>
From: nospam@wanadoo.nl (Schelte)
In-Reply-To: <20230530213832.0dad2d87@lud1.home>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <nnd$2c57727c$7c84c548@6791c3dcf0bc34d2>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!94.232.112.245.MISMATCH!feed.abavia.com!abe005.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 80
Injection-Date: Sun, 11 Jun 2023 14:59:10 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: Schelte - Sun, 11 Jun 2023 12:59 UTC

On 31/05/2023 02:38, Luc wrote:
> Now, how would you turn a text line into a drag-and-drop source?
>
> How would one be able to drag a text widget line onto something else?
>
You indicated in a different thread that despite all the tips and hints
you received, you still haven't managed to get this working. Then let me
spell it out for you.

The code below uses a treeview to show a list of files and directories.
In accordance with your original description, both files and directories
can be dragged. But dropping is only acceptable for directories.

# Create a treeview for the list of files
ttk::treeview .tv1 -yscrollcommand [list .vs1 set] -show tree
# For simplicity, just give directories a different font color rather
# than some nice icon
..tv1 tag configure directory -foreground #008000
ttk::scrollbar .vs1 -command [list .tv1 yview]
grid .tv1 .vs1 -sticky nsew
grid columnconfigure . .tv1 -weight 1
grid rowconfigure . .tv1 -weight 1

# Fill the treeview with the files and directories in the current path
foreach name [lsort [glob -nocomplain -directory [pwd] *]] {
.tv1 insert {} end -id $name -text [file tail $name] \
-tags [list [file type $name]]
}

# --------------------------------------------------------------------

# Drag & drop implementation
package require tkdnd

# Register the treeview as both a drag source and drop target
tkdnd::drag_source register .tv1 {DND_Files}
tkdnd::drop_target register .tv1 {DND_Files}

# Set up the minimum bindings
bind .tv1 <<DragInitCmd>> {dragstart %W %X %Y}
bind .tv1 <<DropPosition>> {dropcheck %W %X %Y}
bind .tv1 <<Drop>> {dropfinish %W %X %Y %D}

# Unfortunately tkdnd doesn't support the %x and %y substitutions.
# We'll have to calculate them from the %X and %Y values.
proc tvitem {w x y} {
set x [expr {$x - [winfo rootx $w]}]
set y [expr {$y - [winfo rooty $w]}]
return [$w identify item $x $y]
}

# Drag all selected files
proc dragstart {w x y} {
set list [$w selection]
if {[llength $list]} {
return [list copy DND_Files $list]
}
}

# Only directories are acceptable for dropping
proc dropcheck {w x y} {
set item [tvitem $w $x $y]
if {[$w tag has directory $item]} {
return copy
} else {
return refuse_drop
}
}

# Generate a file copy command when files are dropped
proc dropfinish {w x y files} {
# Make sure the drop location is valid
if {[dropcheck $w $x $y] ne "refuse_drop"} {
set item [tvitem $w $x $y]
puts [list file copy {*}$files $item]
}
}

Re: Help with a design decision

<20230611174724.0b1bba82@lud1.home>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22277&group=comp.lang.tcl#22277

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Help with a design decision
Date: Sun, 11 Jun 2023 17:47:24 -0300
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <20230611174724.0b1bba82@lud1.home>
References: <20230529154358.419c080d@lud1.home>
<u53799$1ljd5$1@dont-email.me>
<20230529212936.19a60736@lud1.home>
<u53nbj$1rj5g$1@dont-email.me>
<20230530213832.0dad2d87@lud1.home>
<nnd$2c57727c$7c84c548@6791c3dcf0bc34d2>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="14d47af9a313dad9f1643f03a3b8c6d1";
logging-data="2957376"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192vAJlDAJkgYviZImKi5vjrc9x+n87Khs="
Cancel-Lock: sha1:i93BXyzoNlhJ8khr60HVQ43AicY=
 by: Luc - Sun, 11 Jun 2023 20:47 UTC

On Sun, 11 Jun 2023 14:59:10 +0200, Schelte wrote:

>You indicated in a different thread that despite all the tips and hints
>you received, you still haven't managed to get this working. Then let me
>spell it out for you.
**************************

Thank you for spelling it out. I needed that. It will certainly be useful.

--
Luc
>>


devel / comp.lang.tcl / Help with a design decision

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor