MouseUp code execution
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
MouseUp code execution
Hi all,
I have, another, doubt on Scrollbars:
using a breakpoint into the mouseUp script of a datagrid, I have observed that the code runs also when I move between lines. without click on a line.
nothing in data shown change but, is it a normal behavior? is it possible to avoid?
best regards
franco
I have, another, doubt on Scrollbars:
using a breakpoint into the mouseUp script of a datagrid, I have observed that the code runs also when I move between lines. without click on a line.
nothing in data shown change but, is it a normal behavior? is it possible to avoid?
best regards
franco
Re: MouseUp code execution
Please post the doubtful code!
Re: MouseUp code execution
Hi Klaus,
when I said:
anyway:
best
franco
when I said:
I meant, using vertical scrollbar, of course.....the code runs also when I move between lines.
anyway:
Code: Select all
on mouseUp --popola i campi con i dati del vino selezionato nella grid
local tLineNumber
-- ## Prepare to access custom property:
put the dghilitedlines of grp "dgViniViti" into tLineNumber
set linedel to numtochar(2)
put the cAllItems of group "dgViniViti" into tArray
put tArray[4] into tAllItems4
put tArray[5] into tAllItems5
put tArray[6] into tAllItems6
put tArray[7] into tAllItems7
put tArray[9] into tAllItems9
put tArray[11] into tAllItems11
-- -- visualizza i dati nei campi del gruppo grpViniVitigno
put GetDataOfLine(tLineNumber, "Vino") into fld "fldVinoViti"
put line tLineNumber of tAllItems4 into fld "fldAlcolMinViti"
put line tLineNumber of tAllItems5 into fld "fldUvaggioViti"
put line tLineNumber of tAllItems6 into fld "fldAltreTipolViti"
put line tLineNumber of tAllItems7 into fld "fldConsumoViti"
put line tLineNumber of tAllItems9 into fld "fldAffinamViti"
put line tLineNumber of tAllItems11 into fld "fldNoteViniViti"
end mouseUp
franco
Re: MouseUp code execution
Hi Franco,
please also post the rest of the (datagrid behavior) script.
Best
Klaus
please also post the rest of the (datagrid behavior) script.
Best
Klaus
Re: MouseUp code execution
Hi Klaus,
my grid is Table style... not sure what do you mean, may be this script:
franco
my grid is Table style... not sure what do you mean, may be this script:
Code: Select all
-- This script defines the behavior of your data grid's custom template. This behavior
-- only applies to 'forms' and not 'tables'.
on FillInData pDataArray
-- This message is sent when the Data Grid needs to populate
-- this template with the data from a record. pDataArray is an
-- an array containing the records data.
-- You do not need to resize any of your template's controls in
-- this message. All resizing should be handled in resizeControl.
-- Example:
set the text of field "Label" of me to pDataArray["label 1"]
end FillInData
on LayoutControl pControlRect
local theFieldRect
-- This message is sent when you should layout your template's controls.
-- This is where you resize the 'Background' graphic, resize fields and
-- position objects.
-- For fixed height data grid forms you can use items 1 through 4 of pControlRect as
-- boundaries for laying out your controls.
-- For variable height data grid forms you can use items 1 through 3 of pControlRect as
-- boundaries, expanding the height of your control as needed.
-- Example:
put the rect of field "Label" of me into theFieldRect
put item 3 of pControlRect - 5 into item 3 of theFieldRect
set the rect of field "Label" of me to theFieldRect
set the rect of graphic "Background" of me to pControlRect
end LayoutControl
on ResetData
-- Sent when data is being emptied because the control is no longer being used to display data
set the text of field "Label" of me to empty
end ResetData
on PreFillInData
-- Sent right before new data is going to replace existing data in the control
end PreFillInData
setprop dgHilite pBoolean
-- This custom property is set when the highlight of your custom template has
-- changed. By default the "Background" graphic will be highlighted for you.
-- You only add script here if you want to further customize the highlight.
-- Example:
if pBoolean then
set the foregroundColor of me to the dgProp["hilited text color"] of the dgControl of me
else
set the foregroundColor of me to empty
end if
end dgHilite
getprop dgDataControl
-- Required by library so that it can locate your control.
return the long ID of me
end dgDataControl
on mouseDoubleUp pMouseBtnNum
local theKey
-- Example of how to edit the contents of a field.
-- By passing the index of the record associated with copy of this template being displayed and
-- a key (array key) the data grid will automatically save the changes the user
-- makes and refresh the UI by calling FillInData and resizeControl.
if pMouseBtnNum is 1 then
if the dgProps["allow editing"] of the dgControl of me then
switch the short name of the target
case "Label"
put "Label 1" into theKey
EditFieldText the long ID of the target, the dgIndex of me, theKey
break
end switch
end if
end if
pass mouseDoubleUp
end mouseDoubleUp
Re: MouseUp code execution
Hi Franco,
thank you, looks OK!?
Sorry, no idea what is going on there, but that should
of course not happen when you simply scroll the group.
Best
Klaus
thank you, looks OK!?
Sorry, no idea what is going on there, but that should
of course not happen when you simply scroll the group.
Best
Klaus
Re: MouseUp code execution
ciao Klaus,
if, you or someone else, want to take a look at this simple code it's a new project only a grid with 3 lines of data. also with the scrollbars grayout, when click on them, the code runs.
thanks for your time
franco
This worries me a bitKlaus wrote:Hi Franco,
thank you, looks OK!?
Sorry, no idea what is going on there, but that should
of course not happen when you simply scroll the group.
Best
Klaus

if, you or someone else, want to take a look at this simple code it's a new project only a grid with 3 lines of data. also with the scrollbars grayout, when click on them, the code runs.
thanks for your time
franco
Re: MouseUp code execution
Hi Franco,
aha, now I get it!
Since the GROUP has this script and a datagrid is a group of grouped grouped groups etc.
we need to check if the mouseclick has occured in the relevant part of the datagrid!
Add something like this and it should work out fine:
Best
Klaus
aha, now I get it!

Since the GROUP has this script and a datagrid is a group of grouped grouped groups etc.
we need to check if the mouseclick has occured in the relevant part of the datagrid!
Add something like this and it should work out fine:
Code: Select all
on mosueup
## Looks like the scrollbars are (part of) this -> graphic "dgBackground"
if the short name of the target = "dgBackground" then
exit mouseup
end if
## Continue with the rest of the script here...
end mouseup
Klaus
Re: MouseUp code execution
do you refer to the mouseUp script?Klaus wrote:Hi Franco,
aha, now I get it!![]()
Since the GROUP has this script....
dgBackground don't works: code still runs. I have used this:
Code: Select all
if the short name of the target = "dgHScrollbar" or the short name of the target = "dgScrollbar" then
exit mouseup
end if

But, it is a normal behavior of the grid? using a mouseUp script, or I'm special?
I mean, if I want to do something at the click of the mouse on a row of a grid, and I've scrollbars, should I expect this? no one before me have used this handler?
thanks again, ciao
franco