Using field with "answer" dialog open

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

swing62
Posts: 6
Joined: Thu Aug 24, 2023 10:47 am

Using field with "answer" dialog open

Post by swing62 » Thu Mar 14, 2024 6:29 pm

Hi,
I introduce myself I am an old italian HyperCard user landed in LiveCode, and I regret I speak English so badly, I hope you understand the meaning. :oops: :oops: :oops:
I need a hint, how can I scroll the field while I have "answer" dialog open ?
in the field, which I need to be able to scroll, there is the data that I need to enter in the "answer" dialog open.

i thank anyone who wants / can help me

Paolo

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Using field with "answer" dialog open

Post by Klaus » Thu Mar 14, 2024 6:36 pm

Buongiorno e benvenuto nel LC forum, Paolo,

short answer: Questo non è possibile! :?
The ASK and ANSWER dialogs are opened as MODAL, which means they block everything until you close them.

What exactly do you need to do?
Maybe we can find another way to do this.


Best

Klaus

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Using field with "answer" dialog open

Post by stam » Thu Mar 14, 2024 6:53 pm

Yeh it sounds like a job for a substack to emulate the answer dialog, possibly as a palette to stay on top.
As Klaus says, anything modal, like the ask/answer dialogs, will by definitely block block everything until dismissed.

Having said that, this seems like atypical and strange interface, and possibly re-thinking the interface would provide a better answer...

swing62
Posts: 6
Joined: Thu Aug 24, 2023 10:47 am

Re: Using field with "answer" dialog open

Post by swing62 » Thu Mar 14, 2024 7:08 pm

With the "Delete source" button of my application I interface with a field, in which are contained lines composed of, in order : code, name, surname, title. (of a text)
I would like to be able to implement the code to delete the exact line in the field that represents the text to be deleted (and therefore of its associated text tab and any many read tabs... but this part is solved).
In practice I do not find an elegant method to delete a row from a field, also because there are other functions that the field performs.
I hope I was clear and in right part of this forum
Thank you
Paolo

swing62
Posts: 6
Joined: Thu Aug 24, 2023 10:47 am

Re: Using field with "answer" dialog open

Post by swing62 » Thu Mar 14, 2024 7:21 pm

stam wrote:
Thu Mar 14, 2024 6:53 pm
Yeh it sounds like a job for a substack to emulate the answer dialog, possibly as a palette to stay on top.
As Klaus says, anything modal, like the ask/answer dialogs, will by definitely block block everything until dismissed.

Having said that, this seems like atypical and strange interface, and possibly re-thinking the interface would provide a better answer...
thanks stam
actually the interface is to be rethought because it does not work for the features that you have illustrated to me.
The floating palette could also work, maybe if I don't find an easier method

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Using field with "answer" dialog open

Post by Klaus » Thu Mar 14, 2024 7:39 pm

swing62 wrote:
Thu Mar 14, 2024 7:08 pm
...
In practice I do not find an elegant method to delete a row from a field, also because there are other functions that the field performs...
Not sure I understand, do you mean that something like:

Code: Select all

...
delete line 42 of fld "your field in question here"
...
will trigger some other commands/function in the script of your field?
If yes, you can suppress these with:

Code: Select all

...
lock messages
delete line 42 of fld "your field in question here"
## more stuff here if neccessary...
unlock messages
...
If that is not what you mean, please explain.

swing62
Posts: 6
Joined: Thu Aug 24, 2023 10:47 am

Re: Using field with "answer" dialog open

Post by swing62 » Thu Mar 14, 2024 8:51 pm

Klaus wrote:
Thu Mar 14, 2024 7:39 pm
swing62 wrote:
Thu Mar 14, 2024 7:08 pm
...
In practice I do not find an elegant method to delete a row from a field, also because there are other functions that the field performs...
Not sure I understand, do you mean that something like:

Code: Select all

...
delete line 42 of fld "your field in question here"
...
will trigger some other commands/function in the script of your field?
If yes, you can suppress these with:

Code: Select all

...
lock messages
delete line 42 of fld "your field in question here"
## more stuff here if neccessary...
unlock messages
...
If that is not what you mean, please explain.
Yes that is the method to delete the row, but wanting to do it with a click on the same row ? Or by searching the line by locating it through code search (or name, title...) and then delete it.
(the code I need which address to go to delete also the text tab and the others associated) is a bit complicated to explain, but thanks all the same I will find the way

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Using field with "answer" dialog open

Post by dunbarx » Thu Mar 14, 2024 11:59 pm

Hi.
Yes that is the method to delete the row, but wanting to do it with a click on the same row ? Or by searching the line by locating it through code search (or name, title...) and then delete it.
As others have said, you cannot do such "simple, ordinary" tasks with a modal dialog open. You are locked out.

But, again as said, you can create a stack that looks exactly like the standard dialog (nicer if you like), and then you are free to do whatever you want. There is a little bit more that you have to pay attention to, but not much.

Craig

swing62
Posts: 6
Joined: Thu Aug 24, 2023 10:47 am

Re: Using field with "answer" dialog open

Post by swing62 » Fri Mar 15, 2024 11:43 am

Good morning
In the end I did as Stam had told me, which I thank.
I used a substack as a dialog window so that I would enter the code number to delete by choosing it from the index field. And the solution works very well. :wink: :wink: :wink:
Thank you very much to everyone for the contributions and the welcome.
Paolo

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7239
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Using field with "answer" dialog open

Post by jacque » Fri Mar 15, 2024 5:48 pm

Do you want to delete a line when the user clicks it? The clickline function will tell you which line was clicked so you won't need a dialog. See "clickline" in the dictionary.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Using field with "answer" dialog open

Post by dunbarx » Fri Mar 15, 2024 6:41 pm

Paolo.

Jacque makes a point. Never do something complicated when something simple will do.

The modal dialogs "Ask" and "Answer" both offer the user a choice of actions, and do something depending on the choice the user makes or the text the user supplies. Deleting a line by hand, as Jacque points out, can be much simpler, its action isolated in and limited to the line the user clicks on.

One click, no line. So?

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Using field with "answer" dialog open

Post by dunbarx » Fri Mar 15, 2024 6:57 pm

@Paolo.

The field must be locked for such activity. Is it?

@ Jacque.

If the field is not locked, it needs a kludge. One way is to place this in the field script:

Code: Select all

on mouseWithin
   if the mouse is down then
      delete line (word 2 of the mouseLine) of the target
      wait until the mouse is up
   end if
end mouseWithin
Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Using field with "answer" dialog open

Post by dunbarx » Fri Mar 15, 2024 7:00 pm

The kludge, or another like it, is needed because in an unlocked field not too many common messages, like "mouseUp", are sent.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7239
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Using field with "answer" dialog open

Post by jacque » Fri Mar 15, 2024 7:09 pm

The dictionary suggests using selectionChanged to catch clicks in an unlocked field.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

swing62
Posts: 6
Joined: Thu Aug 24, 2023 10:47 am

Re: Using field with "answer" dialog open

Post by swing62 » Fri Mar 15, 2024 7:16 pm

I know the clickLine function, unfortunately the construction of my application is more complicated and difficult to explain, (especially with a machine translation (Do you understand well what I write?)) so it is not usable in this context. I tried to use it but to no avail.
However with the additional substack the function works, for me it is ok.
Certainly there will be a better way to do the task, but in the meantime if it works it is ok.
I started this application many years ago, in the meantime I use it, (so as not to lose data), and the versions are many with which I have eliminated problems and added or modified various functions.
Probably the real problem lies in the addressing mode of the index field, which is a bit crude, but works in a way without possible errors.
But as I said, the important thing is that it works.
Buona Serata :D
Paolo

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”