Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sparse effects SelStart and SelLength
Message
From
06/06/2001 08:58:19
 
 
To
05/06/2001 17:29:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00514899
Message ID:
00515675
Views:
11
Hi!

The code is too complex and dispersed between a lot of modules, this is a "try" application with some interesting approaches to programming in VFP. The approach was to edit grid cells only be the usual controls, not by controls in the grid. So I set up the line of controls over the grid for editing mode.

There are no a single piece of code I can show you. I can, however, describe all things required to do to implement it.

SO, to put edit box over the grid and show it for current cell, you require following things:

- Handle BeforeRowColChange and AfterRowColChange event. In BeforeRowColChange hide the edit box if it is shown. In the AfterRowColChange event show edit box if the new column is a column for which you require to show the edit box.

- To show edit box at the proper place, calculate its properties by following way (assuming "this" is a grid):
nColIndex = ... && index of the column for control
nColumnPos = ... && calculate the column position.
&& do this in a loop through all .columns() collection 
&& using .ColumnCount, .LeftColumn, .column.ColumnOrder, .column.Visible,
&& and .colmn.Width properties.
&& Thats if you want the generic aproach. For a single use do this just manually ;)
nRelRow = this.RelativeRow && assume you show edit box only when grid is focused
nRelRow = this.RelativeRow && Need to do this twise for correct result
thisform.EditingBox.Move(;
  ObjToClient(this,2) + ;
    iif(this.RecordMark,10,0)+ ;
    iif(this.DeleteMark,8,0)+nColumnPos, ;
  ObjToClient(this,1)+this.HeaderHeight+1+(this.RowHeight)*nRelRow, ;
  this.Columns(nColIndex).Width, ;
  this.RowHeight-1 ) && -1 because 1 point is reserved for grid lines.
thisform.EditingBox.Refresh
thisform.EditingBox.Visible = .T.
- To refresh controls correctly, reposition the box in the Scrolled event and certain other events (see next paragraph). In above positioning algorithm, check if nColumnPos with all other things do not go out of grid. Note that left column is not cut by the grid edge, when right column is cut. You can sho box partially as grid does. To calculate left edge of visible area, use sysmetric() function to get the width of the vertical scrollbar (it is sysmetric(5) if I remember correctly).
- Grid could be scrolled also when tabbing from control to control, changing focus etc. Need to tune it a lot to catch all events fired when this happens. I did the same refreshing as in Scrolled event in other places that I do not remember. Test it a lot.

HTH.

>Vlad,
> I would be interested to see how you did this with your editbox.If you could give an example I would appreciate it.
>
>Thanks,Randy
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform