list fld mouserelease

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

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

list fld mouserelease

Post by jmburnod » Wed May 18, 2011 10:44 am

Hi All,

Theres a list field : MutipleHilite = false,ContiguousHilite = false,ContiguousHilite = false
I need to restaure the prev hilitedlines (on only in this case) of a list field when the user clic and the mouse is not over the fld

This script make the job but maeby someone have a best way

Code: Select all

local sPrevNoLine,sCurNoLine,sLeCurFld

on mouseenter
   put the short name of the target into sLeCurFld
   put the hilitedlines of fld sLeCurFld into sPrevNoLine
      dansmes sPrevNoLine&&sCurNoLine
end mouseenter

on mousedown
   put the hilitedlines of fld sLeCurFld into sCurNoLine
   dansmes sPrevNoLine&&sCurNoLine
end mousedown

on mouseup
   put the hilitedlines of fld sLeCurFld into sCurNoLine
   put sCurNoLine into sPrevNoLine
   dansmes sPrevNoLine&&sCurNoLine
end mouseup

on mouseLeave
   put the hilitedlines of fld sLeCurFld into sCurNoLine
   put sCurNoLine into sPrevNoLine
   dansmes sPrevNoLine&&sCurNoLine
end mouseLeave

on mouserelease
   set the hilitedlines of fld sLeCurFld to sPrevNoLine
      dansmes sPrevNoLine&&sCurNoLine
end mouserelease

--•• DEV
on dansmes t
   if the environment = "development" then
      put t
   end if
end dansmes
Best from Geneva beach

Jean-Marc
Attachments
MousereleaseListFld.rev.zip
(1.33 KiB) Downloaded 234 times
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: list fld mouserelease

Post by dunbarx » Wed May 18, 2011 5:25 pm

Hi.

The scripts you have for the list field display (in the message box) the new clicked line on mouseDown, and retain the previous one, but then that info is duplicated on mouseUp (or mouseRelease). The action in the field itself is identical to one with no scripts at all. Did you want to store the clickLine history? I don't get what you mean when you say the user clicks outside the field.

Craig Newman

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: list fld mouserelease

Post by jmburnod » Wed May 18, 2011 5:49 pm

Hi,
The action in the field itself is identical to one with no scripts at all
No. If you clic outside the fld the hilitedlines = the num of the clicked line

Jean-Marc
https://alternatic.ch

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: list fld mouserelease

Post by SparkOut » Wed May 18, 2011 9:46 pm

I confess, I'm really struggling to know what you are trying to achieve as the result here. I am probably wrong, but I feel that you may have a list field which has a selection made. If the user clicks outside that list field, then the selection reverts to the line previously selected?
So I may choose line 3, and you want that line to be preserved, so that if I were to choose line 7 and then click outside the field, the field would revert to show line 3 selected?
If that is the case then you could use a selectionChanged handler to catch the event and rotate a pair of values in custom properties of the field. A mouseUp handler on the card could check for a click, and check that it was outside the field, restoring the line to the value preserved in the custom property.
I adapted your stack to add a field showing in action what I mean, hoping that this is even remotely correct. If not, please can you explain a bit more what it is you are trying to achieve?
Attachments
MousereleaseListFld.zip
(1.12 KiB) Downloaded 240 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: list fld mouserelease

Post by jmburnod » Thu May 19, 2011 6:58 pm

Hi SparkOut
Thank for your reply
If the user clicks outside that list field, then the selection reverts to the line previously selected?So I may choose line 3, and you want that line to be preserved, so that if I were to choose line 7 and then click outside the field, the field would revert to show line 3 selected?
Yes

Code: Select all

 If that is the case then you could use a selectionChanged handler to catch the event and rotate a pair of values in custom properties of the field.
Yes. That is a best way for me
A mouseUp handler on the card could check for a click, and check that it was outside the field, restoring the line to the value preserved in the custom property.
No. The mouseup handler is not catched by the card. MousereleaseListFld01.rev avoid the script cd

Jean-Marc
Attachments
MousereleaseListFld01.rev.zip
(1.88 KiB) Downloaded 227 times
https://alternatic.ch

Post Reply