Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Losing grid formatting
Message
From
05/03/2006 15:03:33
 
 
To
05/03/2006 10:35:44
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01099587
Message ID:
01101593
Views:
17
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 ..

"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 ...

the 3 methods of the gridclass i posted are the point of the message .. the rest is just a bad example to prove that it works :)

"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 ..

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 .

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.

Regards
Christian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform