It is currently Fri Sep 10, 2010 9:36 am




Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2, 3  Next
A Funny Thing Happened In The Way To The Browse :) 
Author Message
HMG Founder
User avatar

Joined: Wed Jul 30, 2008 6:43 pm
Posts: 2338
Post A Funny Thing Happened In The Way To The Browse :)
IMHO, the ugliest thing in HMG is the Browse control, but before blame me, please, let me say that this is not (mostly) my fault :)

I'll explain that:

Back in time to early 2002, I've researched about a Windows native control that could be a good host for a Browse, so, I've decided that such control should be ListView.

Very soon realized that filling it with the 'additem' method (calling as many times as rows in the table) could work for small-sized ones only, so, I've discovered the 'virtual ListView'.

The virtual ListView must not be filled in the usual way. It automatically calls an user-specified procedure (a 'callback' procedure) each time that it must draw a cell in the screen.

Such procedure receives the cell's row and column. The user must return the adequate content for that cell.

So, theoretically, you could handle billion records tables without any noticeable speed overhead.

You only should go to the required row and retrieve the data.

It worked fine for non indexed tables using dbGoto() function and was really fast.

The problem was that for making indexed tables to work in this scheme, I've needed the OrdKeyGoTo()/OrdKeyNo() functions, but by 2002 these functions were not implemented in Harbour.

Finally I've 'solved' the problem using a standard ListView containing only 'visible' records and implementing a terribly complex trickery to pretend that it was the real thing.

I've never abandoned my original idea and attempted again many years later, when the OrdKeyGoTo() and OrdKeyNo() were finally implemented, but they were very very slow,
making again impossible to use (I've attempted complex cache schemes to speed up the process with no results).

Now, I've decided to try again and guess what...?

It works smoothly and quickly now!!!

My original idea was that we should have only one table style control to handle arrays, dbf files and random data. That control should be the Grid, so I've done :)

The code attached to this message should be considered as 'pre-alpha'.

This means that it could be unstable, unreliable and (more important) that the sources are really ugly and dirty :)

So, this is not 'Test XIV' yet, this is only some thoughts in the form of code.

The final idea (if this finally works and get all browse powers) is to fully replace browse.

Is all this thing redundant, considering that Browse already is there?

The current Browse should be kept for backwards compatibility only, in the form of a wrapper for a data grid, and completely eliminated from documentation, so, at the end, will not be redundancy.

Quote:
- HMG 3.0.0 (Forum Test ???) Changelog:

English:
--------

- New: Virtual Grid supports allowedit, ColumnWhen, ColumnValid
DynamicBackColor, DynamicForeColor and ColumnControls properties now.
Sample: GRID_24.

- New: Grid supports the following new things:

- 'RecordSource' Property.
- 'ColumnFields' Property.
- 'AllowAppend' Property.
- 'Buffered' Property.
- 'RecNo' Property.
- 'Append' Method.
- 'Save' Method.
- 'Refresh' Method.

These new elements are meant to give to grid, support for dbf
tables handling.

In 'Buffered' mode, adding a record, store it in a temporary
(1 record buffer). This buffer is flushed when you add another
record, with the 'Save' method or when the grid control is
released. The main advabtage of this way is that the new record
goes to the end of the grid, not being affected by current
index order (it will be ordered when saved).

'Append' has the Alt+A shortcut.
'Save' has the Alt+S shotcut.

You can set currently selected item with the 'Value'
property, as in a standard 'CellNavigation' style grid.
Alternatively you can use 'RecNo' property to set selected
item with physical record number.

'Refresh' method is meant to update changes made outside from
grid.

Is this redundant, duplicating Browse functionality?: No!

Please, read the 'Something funny happened in the way to
the browse' article in HMG Forum (http://www.hmgforum.com) for a
detailed explanation.

Sample: GRID_25.



Enjoy!


Attachments:
hmg_300_datagrid_test.rar [1.02 MiB]
Downloaded 127 times

_________________
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Sun Jan 03, 2010 4:36 am
Profile
User avatar

Joined: Tue Jul 29, 2008 6:30 pm
Posts: 1973
Location: Sivakasi, India
Post Re: A Funny Thing Happened In The Way To The Browse :)
Amazing Roberto. Do you still have only 24 hours a day? I doubt.

_________________
East or West HMG is the Best.
South or North HMG is worth.


Sun Jan 03, 2010 7:06 am
Profile YIM WWW
User avatar

Joined: Wed Jul 30, 2008 9:17 pm
Posts: 1421
Location: Alexandretta / Turkey [36.570084 N 36.169009 E]
Post Re: A Funny Thing Happened In The Way To The Browse :)
Wonderful :shock: :P

Thanks a lot maestro :D

Best Regards

--

Esgici

_________________
Viva Clipper !


Sun Jan 03, 2010 10:20 am
Profile WWW
HMG Founder
User avatar

Joined: Wed Jul 30, 2008 6:43 pm
Posts: 2338
Post Re: A Funny Thing Happened In The Way To The Browse :)
rathinagiri wrote:
Amazing Roberto. Do you still have only 24 hours a day? I doubt.


I always find spare time to do funny things :)

And an important thing for people (like you and me) working with remote data is the 'grid.24' sample.

You have now full control over virtual Grid, so you can edit and add when/valid procedures, so to deal with remote data, you only need to give to virtual grid the needed info in the 'OnQueryData' procedure.

Please, give it a try...

_________________
Regards/Saludos,

Roberto


(Veritas Filia Temporis)


Sun Jan 03, 2010 12:33 pm
Profile
HMG Founder
User avatar

Joined: Wed Jul 30, 2008 6:43 pm
Posts: 2338
Post Re: A Funny Thing Happened In The Way To The Browse :)
esgici wrote:
Wonderful :shock: :P

Thanks a lot maestro :D

Best Regards

--

Esgici


Thanks!

_________________
Regards/Saludos,

Roberto


(Veritas Filia Temporis)


Sun Jan 03, 2010 12:36 pm
Profile
HMG Founder
User avatar

Joined: Wed Jul 30, 2008 6:43 pm
Posts: 2338
Post Re: A Funny Thing Happened In The Way To The Browse :)
And...

Please test and report any problem you found!

_________________
Regards/Saludos,

Roberto


(Veritas Filia Temporis)


Sun Jan 03, 2010 12:48 pm
Profile
HMG Founder
User avatar

Joined: Wed Jul 30, 2008 6:43 pm
Posts: 2338
Post Re: A Funny Thing Happened In The Way To The Browse :)
Roberto Lopez wrote:
And an important thing for people (like you and me) working with remote data is the 'grid.24' sample.


Or local data coming from (ie) SqLite.

_________________
Regards/Saludos,

Roberto


(Veritas Filia Temporis)


Sun Jan 03, 2010 12:50 pm
Profile
User avatar

Joined: Tue Jul 29, 2008 6:30 pm
Posts: 1973
Location: Sivakasi, India
Post Re: A Funny Thing Happened In The Way To The Browse :)
Unfortunately I can't compile the samples. :(

This is the error log.

Code:
hbmk2: Processing configuration: C:\hmg\harbour\bin\hbmk.cfg
hbmk2: Processing: demo.hbc
hbmk2: Linking... demo.exe
C:/hmg//lib/libminigui.a(h_menu.o):h_menu.c:(.text+0x2f): undefined reference to `hb_vmProcessSymbolsEx'
C:/hmg//lib/libminigui.a(h_msgbox.o):h_msgbox.c:(.text+0x2f): undefined reference to `hb_vmProcessSymbolsEx'
C:/hmg//lib/libminigui.a(h_button.o):h_button.c:(.text+0x2f): undefined reference to `hb_vmProcessSymbolsEx'
C:/hmg//lib/libminigui.a(h_winapimisc.o):h_winapimisc.c:(.text+0x2f): undefined reference to `hb_vmProcessSymbolsEx'
C:/hmg//lib/libminigui.a(h_hotkey.o):h_hotkey.c:(.text+0x2f): undefined reference to `hb_vmProcessSymbolsEx'
C:/hmg//lib/libminigui.a(h_label.o):h_label.c:(.text+0x2f): more undefined references to `hb_vmProcessSymbolsEx' follow
collect2: ld returned 1 exit status
hbmk2: Error: Running linker. 1
gcc.exe .hbmk\win\mingw\demo.o .hbmk\win\mingw\_hbmkaut.o _temp.o    -mwindows -Wl,--start-group -lminigui -lhbmysql -lmysql -lcrypt -ledit -leditex -lgraph -lini -lreport -lhbwin -lhbziparc -lhbmzip -lmsvfw32 -lvfw32 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbvpdf -lhbmemio -lhbsqlit3 -lsqlite3 -lhbfimage -lhbpgsql -lpq -lhbtip -lhbct -lhbmisc -lhbnetio -lxhb -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib  -Wl,--end-group -odemo.exe -LC:/hmg/harbour/lib -LC:/hmg//lib -LC:/hmg/SAMPLES/GRID.24/

_________________
East or West HMG is the Best.
South or North HMG is worth.


Sun Jan 03, 2010 7:18 pm
Profile YIM WWW

Joined: Thu Nov 19, 2009 2:23 pm
Posts: 67
Post Re: A Funny Thing Happened In The Way To The Browse :)
Roberto Lopez wrote:
And...

Please test and report any problem you found!


Windows XP SP3 :arrow: HMG Test XIII :arrow: Grid25 :arrow: no problems :!:


Sun Jan 03, 2010 8:49 pm
Profile
User avatar

Joined: Wed Feb 11, 2009 10:56 am
Posts: 543
Location: Americana - SP
Post Re: A Funny Thing Happened In The Way To The Browse :)
Very very AMAZING master.

Thanks a lot.

My best regards,

_________________
--
Paulo Sérgio Durço (Vanguarda)
"All you need is love" (The Beatles)

http://hmglights.wordpress.com/


Sun Jan 03, 2010 9:42 pm
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page 1, 2, 3  Next


Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forum/DivisionCore.