Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-08

Simulating a DBNavigator

9 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Arí Ricardo Ody

I'm trying to simulate a DBNavigator, since the Lazarus components has certain troubles in the windows mobile devices. I'm trying to create a single database tool with my navigator and a DBGrid. When the ?+? is clicked I insert a line in the Dataset associated and then it appears new line in the DBGrid. This was the only way I can get a new line in the DBGrid. First trouble: I must click in the new line to open it for typing. After type the data in the 2 new columns of the grid, I click the Post button. There is no execution errors, but the line is not included in the SQL table. May someone look the code at http://www.4shared.com/file/CY40f7PM/myNavigator.html and tell me what's wrong?
Future problems I'd see:

*
If the user alter one line of the Grid how I discover and make the update in the SQL table? In this case , does the Dataset becomes in the dsEdit mode automatically? How do I can discover, at post time, all the lines that user has altered? *
*
When the user clicks ?Cancel? if he has clicked in the ?+? button I must call the method ?cancel? or ?clear? of the Dataset? If the user update various lines how I ignore the alterations in these various lines? *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110805/109f8d8f/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Arí Ricardo Ody

The problem is caused because TDBNavigator uses TSpeedButton to implement it's buttons, which are buttons which cannot receive focus.

This is Delphi-compatible, but to me this is also a major accessibility issue. It means that blind people for example cannot use TDBNavigator!

To fix this I want to introduce a Options property with the style noFocusableButton. If this option is activated, then the buttons will be based on TBitBtn instead, so the control will be accessible, so it remain fully Delphi compatible, but you can adapt it to be accessible too.

Any comments or anyone opposed?

Felipe Monteiro de Carvalho

Reply by email

Unknown author
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 6 lines
The problem is caused because TDBNavigator uses TSpeedButton to implement it's buttons, which are buttons which cannot receive focus. This is Delphi-compatible, but to me this is also a major accessibility issue. It means that blind people for example cannot use TDBNavigator!

I'm sure that blind people can live with this limitation, so I don't really consider this argument very valid :-)

Show quoted text 7 lines
To fix this I want to introduce a Options property with the style noFocusableButton. If this option is activated, then the buttons will be based on TBitBtn instead, so the control will be accessible, so it remain fully Delphi compatible, but you can adapt it to be accessible too. Any comments or anyone opposed?

There is a reason why these buttons cannot receive focus.

If they receive focus, then the currently active control loses focus.

If it is a DB-Aware control, This means that the control may decide to post pending data changes. This in turn will change the state of the dataset to something other than the state the navigator button expects, and the state change notification will arrive too late for the button to ignore the click.

So changing this is IMHO not per se a good idea.
If you do include this option, make sure it is not activated by default.

Michael.

Reply by email

Felipe Monteiro de Carvalho
to Unknown author
If it is a DB-Aware control, This means that the control may decide to post pending data changes. This in turn will change the state of the dataset to something other than the state the navigator button expects, and the state change notification will arrive too late for the button to ignore the click.

Yes, but if you consider that it cannot be used at all in phones without a touch screen at the moment, I suppose it can't get any worse then it is now.

Plus it is an option. Plus it is off by default.

So changing this is IMHO not per se a good idea. If you do include this option, make sure it is not activated by default.

Yes, it is off by default, of course, otherwise it would not be backwards compatible.

I commited in rev31874

To make this work you need to set:

Options = [noFocusableButtons]
TabStop = True

Options is available in the object inspector from now on.

Felipe Monteiro de Carvalho

Reply by email

Unknown author
to Felipe Monteiro de Carvalho: Yes, but if you consider that it cannot be used at all in phones without a touch screen…
Felipe Monteiro de Carvalho wrote 9 lines
On Fri, Aug 5, 2011 at 2:47 PM, wrote: > If it is a DB-Aware control, This means that the control may decide to post > pending data changes. This in turn will change the state of the dataset to > something other than the state the navigator button expects, and the state > change notification will arrive too late for the button to ignore the click. Yes, but if you consider that it cannot be used at all in phones without a touch screen at the moment, I suppose it can't get any worse then it is now.

Well, I assume that 99% of all lazarus development is still for PCs.

The current situation is not exactly what I would describe as 'bad' so saying that 'things couldn't get worse' sounds very funny indeed from where I stand :-)

Michael.

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote
On Fri, Aug 5, 2011 at 3:09 PM, Bart wrote: > You are aware that this reads (to human readers) as No Focusable > Buttons, when infact it means the opposite? <G>

I changed it to:

Options = [navFocusableButtons]
TabStop = True

=)

Felipe Monteiro de Carvalho

Reply by email