Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disable grids rows dynamically
Message
From
29/08/2008 04:21:58
 
 
To
29/08/2008 03:13:45
Albert Beermann
Piepenbrock Service Gmbh & Cokg
Osnabrück, Germany
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
MySQL
Miscellaneous
Thread ID:
01342969
Message ID:
01342985
Views:
17
>Hello Everybody
>
>I have a form with a grid to enter monthly time data for contracts into a cursor.
>
>The cursor has always 31 rows. (= day 1 to 31,1 to 31 marks,1 to 31 starttimes,1 to 31 endtimes ...)
>The cursor is filled with default planning data values for the given month and contract.
>Now i want to do 2 things:
>a:
>Disable (or set to read only) some rows under spezial circumstances.
>(disable row 30 and 31 if month = februar or disable row 1 to 14 if contract starts on 15s day of month)
>The actual month and the contract start date are values of textboxes in my form.(can be part of the cursor if needed)
>
>b:
>disable(or set to read only) a row column for spezial circumstances.
>If field MARK in column2 contais "XYZ" or "YYY" or ... it can't be changed. If MARK has another value it can be changed.
>
>Any help welcomed
>Best regards
>Albert

Try (NOT TESTED):
*** Form Init event
** Only one column, there is no need this method to be executed for ALL columns
thisform.Grid1.Column1.DynamicBackColor = [thisform.AllowGrid()]

*** Form AllowGrid method
LOCAL lnLastDay
LOCAL lbAllowCellSelection
lbAllowCellSelection = .t.

*** Find the last day of the month. There are a lot of examples here in UT how to do this
lnLastDay = LastDayOfMonth(some parameter) 

IF m.lnLastDay < Cursor.SomeField && I don't know how you store the 30 or 31 when the date is in Febr.
   lbAllowCellSelection = .f.
ENDIF

IF Cursor.ContractStarts > Cursor.SomeField && The same field as in above where you stores dates or day or?
   lbAllowCellSelection = .f.
ENDIF

IF OtherSpecialConditions 
   lbAllowCellSelection = .f.
ENDIF

thisform.Grid1.AllowCellSelection = m.lbAllowCellSelection

RETURN thisform.Grid1.Column1.BackColor
As I said this is not tested :-)


Am I missing something? Why the code has no syntax coloring?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform