Datagrid lost focus to next cell inside a group

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Datagrid lost focus to next cell inside a group

JosepM
Hi,

I have a datagrid inside a group. Adding a row and doubleclicking to edit the cell, and pressing tab key, the focus jump to the next cell and the next and the next. All ok.
But If I fill some value and press tab, the next cell enter in edit mode but the focus is lost and the datagrid cell still in edit mode but without having the focus. You must click inside again fill some value continue.

The same datagrid without belong to any group run fine.

Why? It's a bug?


Salut,
Josep
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid lost focus to next cell

zryip theSlug
Hi Josep,

When a DataGrid is in a group and you want to navigate inside it, it
seems that it lost the focus, resulting to this odd behavior.

It's probably a bug.

I will propose you a possible solution to help. It consists to change
the default column behavior of your Data Grid.
In this custom behavior you can fix the bug to let your Data Grid in a
group, performs as you expect.

1) Create a button, name it "Custom Behavior" and set its content script to:


-- This script defines the behavior of a table column's custom template.

on FillInData pData
    -- This message is sent when the Data Grid needs to populate
    -- this template with the column data. pData is the value to be displayed.

    -- Example:
    set the text of field 1 of me to pData
end FillInData


on LayoutControl pControlRect
    -- This message is sent when you should layout your template's
controls if your template is a group.
    -- If your template is not a group then there is no work to do here.
    -- You can use items 1 through 4 of pControlRect as boundaries for
laying out your controls.

    -- Example:
    set the rect of field 1 of me to pControlRect
end LayoutControl


setprop dgHilite pBoolean
    -- This custom property is set when the highlight of your column
template has
    -- changed. You only add script here if you want to customize the highlight.

    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


-- Data grid will call EditValue if a user action asks to edit cell content.
command EditValue
    if there is a field 1 of me then
        EditFieldText the long id of field 1 of me, the dgIndex of me,
the dgColumn of me
        EditFieldText the long id of field 1 of me, the dgIndex of me,
the dgColumn of me
    end if
end EditValue


on mouseDoubleUp pMouseBtnNum
    -- Example of how to edit the contents of a field (assuming the
column template this is
    -- associated with is a field).
    -- By passing the index of the record linked to the copy of this
template and the name of the
    -- column being edited 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 word 1 of the target is "field" then
            ## word 1 to -2 because of unique numbers (i.e. 0001,
0002) that the data grid adds to each
            ## copy of this template that is made.
            if the dgProps["allow editing"] of the dgControl of me \
                    and the dgColumnIsEditable[the dgColumn of me] of
the dgControl of me then
                EditCellOfIndex the dgColumn of me, the dgIndex of me
                exit mouseDoubleUp
            end if
        end if
    end if

    pass mouseDoubleUp
end mouseDoubleUp


--> The trick here is to double the line:
EditFieldText the long id of field 1 of me, the dgIndex of me, the
dgColumn of me

It force the focus to stay inside the field.

2) Assign this new column behavior with this code:

set the dgProp["default column behavior"] of grp "MyDataGrid" to the
long id of button "Custom Behavior"

3) At last, remove the dim focus behavior by executing this script:

set the dgProp["dim on focusOut"] of grp "MyDataGrid" to true

You can expect a better solution than mine, but for now it fix the problem 8-)

Regards,

2010/6/19, JosepM <[hidden email]>:

>
> Hi,
>
> I have a datagrid inside a group. I add a row and doubleclick to edit the
> cell value, and pressing tab key jump to the next cell. But If I fill some
> value and press tab, the next cell is edit but lost the focus and the
> datagrid still in edit mode but without the focus.
>
> Why? The same datagrid with the group run fine.
>
>
> Salut,
> Josep
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/Datagrid-lost-focus-to-next-cell-tp2260851p2260851.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>


--
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid lost focus to next cell

JosepM
Hi Zryip,

Thanks for your solution :)

3) At last, remove the dim focus behavior by executing this script:

set the dgProp["dim on focusOut"] of grp "MyDataGrid" to true

I don't understand this last step.. only duplicating the line run fine. By default the "dim on focusOut" is true.

dim on focusOut
- If true then the highlighted lines will be dimmed to 'dimmed hilite color' when the data grid does not have focus. Default is true.


Salut,
Josep



Reply | Threaded
Open this post in threaded view
|

Re: Datagrid lost focus to next cell

zryip theSlug
You're welcome ;)

In fact the last step is cosmetic. 8-)
Because your Data Grid losts the focus, and the "dim on focusOut"
property is set to true, the selected row will be grey instead to be
blue as in the normal behavior.

Set the dim on focus to false give the illusion that all perfoms
normally, so that the line remains blue when you navigate inside it
with the keyboard.

But yes the solution is in step 2 ;)

Regards,

2010/6/19, JosepM <[hidden email]>:

>
> Hi Zryip,
>
> Thanks for your solution :)
>
> 3) At last, remove the dim focus behavior by executing this script:
>
> set the dgProp["dim on focusOut"] of grp "MyDataGrid" to true
>
> I don't understand this last step.. only duplicating the line run fine.
>
>
> Salut,
> Josep
>
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/Datagrid-lost-focus-to-next-cell-inside-a-group-tp2260851p2261224.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>


--
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid lost focus to next cell

Trevor DeVore
In reply to this post by JosepM
On Jun 18, 2010, at 7:32 PM, JosepM wrote:

> I have a datagrid inside a group. I add a row and doubleclick to  
> edit the
> cell value, and pressing tab key jump to the next cell. But If I  
> fill some
> value and press tab, the next cell is edit but lost the focus and the
> datagrid still in edit mode but without the focus.

Seems to be a bug in the engine. Focus is supposed to be on the field  
that opens for editing. If you look at EditFieldText in the data grid  
behavior script you will see these lines:

lock messages
    focus on sFieldEditor
    focus on sFieldEditor ## When tabbing through table cells engine  
would not focus on sFieldEditor without 2nd call

As you can see I have two calls to focus on the field because the  
engine was not behaving properly. When the data grid is inside another  
group even this workaround doesn't seem to do the trick. You could add  
a third call to focus on the field editor and it might do the trick.

--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid lost focus to next cell

JosepM
Hi Trevor,

So in the "EditValue" left only one?

command EditValue
    if there is a field 1 of me then
        EditFieldText the long id of field 1 of me, the dgIndex of me, the dgColumn of me
        EditFieldText the long id of field 1 of me, the dgIndex of me, the dgColumn of me
    end if
end EditValue



Salut,
Josep
Reply | Threaded
Open this post in threaded view
|

Re: Datagrid lost focus to next cell

Trevor DeVore
On Jun 21, 2010, at 5:48 PM, JosepM wrote:

> So in the "EditValue" left only one?
>
> command EditValue
>    if there is a field 1 of me then
>        EditFieldText the long id of field 1 of me, the dgIndex of  
> me, the
> dgColumn of me
>        EditFieldText the long id of field 1 of me, the dgIndex of  
> me, the
> dgColumn of me
>    end if
> end EditValue

If you change the data grid behavior script then yes. If you want to  
use the double EditFieldText solution then leave it in there twice.

--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution