Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Losing grid formatting
Message
De
06/03/2006 19:33:13
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
05/03/2006 15:03:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01099587
Message ID:
01101897
Vues:
20
>Hello Dragan,
>
>"Of course it's feasible, but it's also unnecessary and too much code - something that may keep you busy and introduce weird bugs and require meticulous testing. Look at what you've done here:
>- created a special class for the editbox
>- saved and restored recordsource for the grid and controlsource each column
>- recreated the editbox's column in code (had to set no less than six properties)"
>
>of course I never write such code .. I never design visual objects in code (who's so insane to do that :) ) ..
>the only reason i've written the code is because it's not possible to post a example form people can copy & paste into a prg and test quickly ..
>
>the only code one needs are the 3 methods of the gridclass -
>put them into a grid baseclass an never every worry about them ..

But what about any column's properties, any non-standard controls (combos, checkboxes) in them... you didn't show an automatic way to restore them. You had code written to do that for a specific editbox. If that editbox had any code in it, you'd have to subclass it for your code to work - which isn't the case with safe selects.

I.e. you're talking about a workaround for a grid rebuild, and I'm talking about completely avoiding such a rebuild.

>"Now imagine you've set few more special things in your grid. Any control that has a bit of code in it would have to be another class of its own, and you'd have to add more lines to your grid resurrection code. Any property that you change on any of the controls in columns would also have to be updated in your code."
>
>one can design a form with a grid visually ... without any need for classes at all (expect the grid baseclass) ...
>you assumed that one has to structure the code like in my example which isn't the case ...

Still, your three methods only restore the controlsources and rowsource, but not the specific controls and other properties. The grid is lost and reborn, a tabula rasa.


>"The so-called safe select is so much simpler and the code which refills the grid's cursor is just two lines (zap grid's cursor, insert into it) - and it doesn't touch the grid at all."
>
>Sure this solution isn't that bad at all .. but just consider that you'll want to replace your dataaccess code to use CursorAdapters and you'll have a problem ..

As Rick Strahl said when CA came up, too little and too late - we all have our solutions for that already. So I'm not using it, and didn't know about that effect. Anyway, probably wouldn't hurt me, because I'm not binding my grids to anything but cursors I create (with Create Cursor), so even if I went down the CA road once, it still wouldn't hurt my grids.

>it's rather odd that the grid (user-interface) produces this side effect.
>User interface and dataaccess should be totally independent.
>
>I don't like the idea to code special dataaccess code to make the grid behave .

Well since this safe select is actually quite simple (just zap the cursor and insert...select into it), I don't mind.

>With the code i posted the method of dataaccess doesn't matter,
>one only has to call the Lock() method before the cursor is rebuild and Unlock() afterwards.

You still haven't convinced me it woudln't lose dynamic* column properties, non-default controls, code in them etc etc. No time to try, though, busy these days.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform