[Gambas-user] TableView Problem
jose.santos at ...429...
jose.santos at ...429...
Thu Nov 3 02:16:10 CET 2005
Hi!
I don't agree with somethings you tell but... a sample code is better than one
thousand words ;)
I hope you'll find useful this piece of code of something I'm working at.
I used to work with Sheridan's DataWidget control under VB and I'm trying to
make a class that covers a TableView control and give me some of the
funcionality of that grid.
To make the example work, you must make a mysql database. This is the code
needed
daniel at ...1204...:~$ mysqladmin -u root -p create testDB
Enter password:
daniel at ...1204...:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.0.24_Debian-10-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> GRANT ALL PRIVILEGES ON testDB.* TO testUser at ...40... IDENTIFIED BY
'testPasswd';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
Then, just execute the code.
It's quite a lot of work to be done yet but some of the funcionality of the
class includes:
- Two modes of operation: Bounded to a database and AddItem (using,
internally,
an String[]).
- Only in Bounded mode:
* Ordering when clicked in a header column.
* Filtering when typing in the table.
* It can filter over diferent columns and datatypes.
* Other stuff...
Quoting nando <nando_f at ...951...>:
> Thank you to the all who gave examples for TableView.
>
> TableView is still implemented incorrectly.
>
> TableView, *unlike* controls in VB (like Flexgrid), requires
> a 2D array of some data (integer,string,etc) to 'refresh' the
> TableView when it needs it. Hundreds of events fire wasting the CPU.
> TableView is supposed to be like that in Flexgrid and others.
> When data is placed in a cell, it is held static there until it is
> changed. It is not the responsibility of Program code to refresh it.
> It is the responsibility of the control to do that.
> Scrolling the Tableview (or clicking on it) isn't supposed to
> require _Data event to fire because the data is already in cells.
>
> Why does the data disappear when scrolled ?
> It's not supposed to.
> It doesn't make sense.
> Even the QT control works 'statically'
> TableView is implemented incorrectly.
>
> If one is to have a TableView with data from many tables in MySQL,
> this means that all scrolling and clicking REQUIRES the MySQL
> queries be performed repeatedly because the cells are 'erased' every
> scroll. If it is a complex page with a lot of scrolling,
> we are speaking of hundreds and thousands of queries.
> Or, if, instead, a 'shadow' array is kept, then hundreds and thousands
> of events are fired (_Data) just to repaint.
>
> This is not correct.
>
> But, perhaps, I am missing something.
>
> Please inform me of my mis-understanding and mis-quidance.
>
> -Fernando
>
>
>
>
>
>
>
> ---------- Original Message -----------
> From: jose.santos at ...1197...
> To: "gambas-user at lists.sourceforge.net" <gambas-user at lists.sourceforge.net>,
> nando <nando_f at ...951...>
> Sent: Wed, 2 Nov 2005 01:48:27 +0100
> Subject: Re: [Gambas-user] TableView Problem
>
>> Hi Nando. I'm not very sure about your problem.
>>
>> I'm working in a database application and I've got TableViews that show
>> perfectly more than 5.000 rows.
>>
>> This is the code of the _Data event.
>>
>> ' EVENTS.
>> ' ================================================
>> PUBLIC SUB Table_Data(Row AS Integer, Column AS Integer)
>> DIM objColumn AS DYGridColumn
>>
>> objColumn = m_columns[Column]
>>
>> SELECT CASE m_bytMode
>> CASE DYGridModesEnum.DYGridModeBound
>> m_rsData.MoveTo(Row)
>> m_table.Data.Text = m_rsData[objColumn.DataField]
>> CASE DYGridModesEnum.DYGridModeAddItem
>> m_table.Data.Text = Split(m_itemList[Row], m_strFieldSeparator)[Column]
>> END SELECT
>>
>> ' In Boolean Columns, An Icon is shown instead text values.
>> IF objColumn.DataType = DYDataTypes.DYBoolean THEN
>> IF CBool(CInt(m_table.Data.Text)) THEN
>> m_table.Data.Picture = UtilLib.IconOK()
>> ELSE
>> m_table.Data.Picture = UtilLib.IconCancel()
>> ENDIF
>> m_table.Data.Text = ""
>> ENDIF
>> END
>>
>> It can be a bit confussing but it's very simple:
>> - FIRST SELECT: There are two working states: bounded to a database
>> or AddItem mode (an Array suplies the info to the TableView). -
>> Aditionally, For boolean values of the database, the TableView only
>> show icons instead of -1 or 0.
>>
>> That's all. Hope you find it useful.
>>
>> Regards.
>>
>> Quoting nando <nando_f at ...951...>:
>>
>> > Benoit,
>> >
>> > After much investigation, I have it appears that
>> > TableView is not implemented correctly.
>> > The example referred to originally (below) works, but
>> > is not the correct way it is supposed to work.
>> > The data in the table is 'deleted' every event '_data'
>> > and an array is used to populate.
>> > A control like this is supposed to hold data 'unchanged'
>> > within the cells - even when scrolled or clicked.
>> > 5000 events while scrolling to repopulate is unreal and is unnecessary.
>> > The control/class is supposed to maintain the data - even when scrolling.
>> > It is wrong.
>> > The number of rows/columns at design time cannot be specified.
>> > I cannot code something like...
>> > TableView1[4,4].Text = "This is 4,4"
>> > If TableView is the QT 'Table View' then it is incomplete
>> >
>> > Please help me understand this problem.
>> > -Fernando
>> >
>> >
>> > ---------- Original Message -----------
>> > From: "nando" <nando_f at ...951...>
>> > To: "Benoit" <gambas-user at lists.sourceforge.net>
>> > Sent: Mon, 31 Oct 2005 17:49:31 -0500
>> > Subject: [Gambas-user] TableView Question
>> >
>> >> I looked at the 'HOW TO PUT VALUES IN A TABLEVIEW WIDGET'
>> >> located at 'www.gambasforge.net/code.php?id=31#notes'
>> >>
>> >> Can someone please inform me as to what makes
>> >> SUB TableView1_Data event fire?
>> >>
>> >> It is not evident to me.
>> >>
>> >> I single stepped through it - No code invokes it
>> >> so it must be an event.
>> >>
>> >> -Fernando
>> >>
>> >> -------------------------------------------------------
>> >> This SF.Net email is sponsored by the JBoss Inc.
>> >> Get Certified Today * Register for a JBoss Training Course
>> >> Free Certification Exam for All Training Attendees Through End of
>> >> 2005 Visit http://www.jboss.com/services/certification for more
>> information
>> >> _______________________________________________
>> >> Gambas-user mailing list
>> >> Gambas-user at lists.sourceforge.net
>> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
>> > ------- End of Original Message -------
>> >
>> >
>> >
>> > -------------------------------------------------------
>> > SF.Net email is sponsored by:
>> > Tame your development challenges with Apache's Geronimo App
>> Server. Download
>> > it for free - -and be entered to win a 42" plasma tv or your very own
>> > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
>> > _______________________________________________
>> > Gambas-user mailing list
>> > Gambas-user at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >
>>
>> ----------------------------------------------------------------
>> This message was sent using IMP, the Internet Messaging Program.
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by:
>> Tame your development challenges with Apache's Geronimo App Server. Download
>> it for free - -and be entered to win a 42" plasma tv or your very own
>> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> ------- End of Original Message -------
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DYGridTest.tar.gz
Type: application/x-gzip
Size: 45951 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20051103/b83b5bc7/attachment.bin>
More information about the User
mailing list