Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[[ DataGrid 2 ]] Edit mode and swipe actions.#1861

Merged
livecodeali merged 1 commit intolivecode:developfrom
livecodemichael:feature-datagrid2_edit_swipe
Dec 18, 2017
Merged

[[ DataGrid 2 ]] Edit mode and swipe actions.#1861
livecodeali merged 1 commit intolivecode:developfrom
livecodemichael:feature-datagrid2_edit_swipe

Conversation

@livecodemichael
Copy link
Copy Markdown
Contributor

@livecodemichael livecodemichael commented Dec 15, 2017

The DataGrid has been extended to include a new edit mode and swipe actions.

The following properties have been added to the DataGrid:

  • set the dgEditMode of group "dg" to <true|false>
  • set the dgProps["animate actions"] of group "dg" to <true|false>
  • set the dgProps["enable swipe"] of group "dg" to <true|false>
  • set the dgProps["edit mode action control"] of group "dg" to <control id>
  • set the dgProps["edit mode action select control"] of group "dg" to <control id>
  • set the dgProps["edit mode reorder control"] of group "dg" to <control id>
  • set the dgProps["left swipe control"] of group "dg" to <control id>
  • set the dgProps["right swipe control"] of group "dg" to <control id>

The following commands have been added to the DataGrid:

  • dispatch "EditModeShowActionControlForIndex" to group "dg" with <index>
  • dispatch "EditModeShowActionControlForIndex" to group "dg" with <true|false>
  • dispatch "RowSwipeShowControlForIndexAndSide" to group "dg" with <index>, <left|right>
  • dispatch "RowSwipeHideControl" to group "dg" with <true|false>

The following messages are sent to the DataGrid:

  • on EditModeReorderStarted pIndex, pLineNo
  • on EditModeReorderCompleted pIndex, pStartLineNo, pNewLineNo

The following messages are sent to the appropriate row control of the DataGrid:

  • on EditModeActionSelectControlClicked pTarget
  • on EditModeActionControlClicked pTarget
  • on EditModeActionControlHidden
  • on RowSwipedRight
  • on RowSwipedLeft
  • on RowLeftSwipeControlClicked pTarget
  • on RowRightSwipeControlClicked pTarget
  • on RowLeftSwipeControlHidden
  • on RowRightSwipeControlHidden

The LayoutControl message sent to the row control has been updated to add a second parameter:

  • on LayoutControl pControlRect, pWorkingRect

The following messages are sent to the each row control of the DataGrid, allowing for control customisation:

  • on GetEditModeActionControl
  • on GetEditModeActionSelectControl
  • on GetEditModeReorderControl
  • on GetLeftSwipeControl
  • on GetRightSwipeControl

revdatagridlibrary.rev has been updated to include the new behaviours and an updated template row behaviour script.

@livecodepanos livecodepanos added this to the 9.0.0-dp-11 milestone Dec 15, 2017
@livecodemichael livecodemichael force-pushed the feature-datagrid2_edit_swipe branch 2 times, most recently from 5c24500 to 655d400 Compare December 15, 2017 17:07
@livecodemichael livecodemichael force-pushed the feature-datagrid2_edit_swipe branch 2 times, most recently from 4b651ad to 37b6f03 Compare December 18, 2017 10:00
Comment thread Documentation/dictionary/datagrid.lcdoc Outdated
Associations: datagrid, datagrid commands

Syntax: dispatch "RowSwipeShowControlForIndexAndSide" to group "DataGrid" with
<row index>, {left | right}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "left" and "right" should be in quotes here

Comment thread Documentation/dictionary/datagrid.lcdoc Outdated
<EditModeActionSelectControlClicked> if you wish to perform a custom behavior.

pTarget is the target of the click. Use this to determine where in the action
control the user clicked.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put the info about pTarget in a

Parameters:
pTarget: 

section

Comment thread Documentation/dictionary/datagrid.lcdoc Outdated
<EditModeActionControlClicked> if you wish to perform a custom behavior.

pTarget is the target of the click. Use this to determine where in the action
control the user clicked.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again here

Comment thread Documentation/dictionary/datagrid.lcdoc Outdated

<pIndex> is the index of the reordered row. <pStartLineNo> is the original line
sequence number of the row within the data grid. <pNewLineNo> is the new line
sequence number of the row within the data grid.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be documented as parameters

local sReorderStartIndex
local sReorderStartLine
local sReorderLastHoverLine
local sReoderMouseMoveInProgress
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bug as you've been consistent, but there's a typo in this variable name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, reoder. I'm an idiot.

local sReorderScrollPollMsgID

constant kReorderScrollPollRate = 30
constant kReoderScrollPollMargin = 30
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reoder here

local sCustomisableControlsInitialised
local sCustomisableControlsA
local sConstomisableControlsSingletonsA
local sConstomisableControlsSingletonCopyMapA
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some constomisable rather than customisables here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not even close. Where did the n come from?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, looks like your fingers got so used to typing constant. I do it all the type with local when I'm trying to lock messages- locak messages all the time

@livecodeali
Copy link
Copy Markdown
Member

This looks great as far as I can tell, other than a couple of docs things and non-critical typos. One minor suggestion I have is that the Get...Control messages be functions rather than on - I see you are constructing the dispatch message generically, but am I right in thinking the ones that are expected to return something are done separately (in which case there's no reason not to use dispatch function)?

@livecodemichael
Copy link
Copy Markdown
Contributor Author

@livecodeali Yeah, I wasn't sure about that. I originally had them as functions since they return a result - it makes sense. But then figured there wasn't really any context elsewhere for doing something similar: The programmer implementing a function that's called by LiveCode felt a bit weird. Handling messages sent by LiveCode felt more typical.

I don't think either method is particularly nice, so I'm happy to go either way. As you say, it's just a single word change (along with docs updates). I don't know if anyone else has an opinion.

@livecodemichael livecodemichael force-pushed the feature-datagrid2_edit_swipe branch from 37b6f03 to 404b67a Compare December 18, 2017 11:14
The DataGrid has been extended to include a new edit mode and swipe actions.

The following properties have been added to the DataGrid:
- set the dgEditMode of group "dg" to <true|false>
- set the dgProps["animate actions"] of group "dg" to <true|false>
- set the dgProps["enable swipe"] of group "dg" to <true|false>
- set the dgProps["edit mode action control"] of group "dg" to <control id>
- set the dgProps["edit mode action select control"] of group "dg" to <control id>
- set the dgProps["edit mode reorder control"] of group "dg" to <control id>
- set the dgProps["left swipe control"] of group "dg" to <control id>
- set the dgProps["right swipe control"] of group "dg" to <control id>

The following commands have been added to the DataGrid:
- dispatch "EditModeShowActionControlForIndex" to group "dg" with <index>
- dispatch "EditModeShowActionControlForIndex" to group "dg" with <true|false>
- dispatch "RowSwipeShowControlForIndexAndSide" to group "dg" with <index>, <left|right>
- dispatch "RowSwipeHideControl" to group "dg" with <true|false>

The following messages are sent to the DataGrid:
- on EditModeReorderStarted pIndex, pLineNo
- on EditModeReorderCompleted pIndex, pStartLineNo, pNewLineNo

The following messages are sent to the appropriate row control of the DataGrid:
- on EditModeActionSelectControlClicked pTarget
- on EditModeActionControlClicked pTarget
- on EditModeActionControlHidden
- on RowSwipedRight
- on RowSwipedLeft
- on RowLeftSwipeControlClicked pTarget
- on RowRightSwipeControlClicked pTarget
- on RowLeftSwipeControlHidden
- on RowRightSwipeControlHidden

The following messages are sent to the each row control of the DataGrid, allowing for control customisation:
- on GetEditModeActionControl
- on GetEditModeActionSelectControl
- on GetEditModeReorderControl
- on GetLeftSwipeControl
- on GetRightSwipeControl

revdatagridlibrary.rev has been updated to include the new behaviours and an updated template row behaviour script.
@livecodemichael livecodemichael force-pushed the feature-datagrid2_edit_swipe branch from 404b67a to 8089bd6 Compare December 18, 2017 11:22
@livecodeali
Copy link
Copy Markdown
Member

@livecodemichael The precedent in my head is NumberOfRows and CacheKeyForRow in the data view, but then again that's not out there for general use! Ok, let's leave it as on then :-)

@livecodeali
Copy link
Copy Markdown
Member

@livecode-vulcan review ok 8089bd6

@livecode-vulcan
Copy link
Copy Markdown

💙 review by @livecodeali ok 8089bd6

@livecodeali livecodeali merged commit 1734126 into livecode:develop Dec 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants