Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #9892 > unrolled thread

Making bBrowser cells editable or non-editable dynamically

Started byrkaplan328 <richard.d.kaplan@gmail.com>
First post2016-11-04 17:37 -0700
Last post2016-11-08 09:12 +0000
Articles 8 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Making bBrowser cells editable or non-editable dynamically rkaplan328 <richard.d.kaplan@gmail.com> - 2016-11-04 17:37 -0700
    Re: Making bBrowser cells editable or non-editable dynamically D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2016-11-05 09:13 +0100
      Re: Making bBrowser cells editable or non-editable dynamically rkaplan328 <richard.d.kaplan@gmail.com> - 2016-11-05 02:49 -0700
    Re: Making bBrowser cells editable or non-editable dynamically Sjonnie D <Sjonnied@gmail.com> - 2016-11-07 07:03 -0800
      Re: Making bBrowser cells editable or non-editable dynamically rkaplan328 <richard.d.kaplan@gmail.com> - 2016-11-07 14:43 -0800
        Re: Making bBrowser cells editable or non-editable dynamically rkaplan328 <richard.d.kaplan@gmail.com> - 2016-11-07 23:20 -0800
          Re: Making bBrowser cells editable or non-editable dynamically Joachim Bieler <support@votools.com> - 2016-11-09 07:02 +0100
    Re: Making bBrowser cells editable or non-editable dynamically Martin <Martin@spam.spam> - 2016-11-08 09:12 +0000

#9892 — Making bBrowser cells editable or non-editable dynamically

Fromrkaplan328 <richard.d.kaplan@gmail.com>
Date2016-11-04 17:37 -0700
SubjectMaking bBrowser cells editable or non-editable dynamically
Message-ID<e93c2d0d-3932-4614-a728-af18f9d178b1@googlegroups.com>
I wish to make a given cell in Column 2 of my bBrowser editable non-editable (and perhaps color it differently), based on the value of the cell in the same row of Column 1.  I'm testing the value of the criterion cell in my CellEdit method, in the BEDIT_HIDE branch for Column 1, but 

   bBrowser:GetColumn(2):editable = .f.

doesn't seem to do the trick.  And I'm not at all sure about coloring cells one-by-one.  Any suggestions?

[toc] | [next] | [standalone]


#9893

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2016-11-05 09:13 +0100
Message-ID<dt4r1ch0b97odi0nu2hs5ea8c9hj2ocmp2@4ax.com>
In reply to#9892
Replying on message of Fri, 4 Nov 2016 17:37:30 -0700 (PDT) from
rkaplan328:


 Hello rkaplan328

Can you give your real name?

This is what you can do. On the init of the browser, add:

	SELF:oDCbBrowserControl:Editable:=TRUE

In this method you determine when or when not to allow editing. In the
code below, this is based on the fieldname or fieldtype of the whole
column. But it should be not too difficult to vary. Also note that
there are some excellent samples shipped with bBrowser, which include
code like this.

METHOD CellEdit(oCellEditEvent) CLASS IndexPercVenster
LOCAL oColumn		AS bDataColumn
LOCAL cFieldname AS STRING
LOCAL nField AS LONGINT

	oColumn := oCellEditEvent:Control:GetOpenColumn
(oCellEditEvent:EditCell:Column)
	IF oCellEditEvent:EditMode == BEDIT_CREATE
		DO CASE
		CASE oColumn:ValType="L" // Checkboxes (logical
fields) can be edited directly
			RETURN TRUE
		CASE oColumn:NameSym == #SOMEFIELD
			RETURN TRUE
		OTHERWISE
			RETURN FALSE
		ENDCASE
	ENDIF
	IF oCellEditEvent:EditMode == BEDIT_COMMIT
		oCellEditEvent:Control:Server:Commit()
		nField:=oColumn:FieldNo
		cFieldname:=oColumn:FieldName
	ENDIF

RETURN TRUE

Dick

[toc] | [prev] | [next] | [standalone]


#9895

Fromrkaplan328 <richard.d.kaplan@gmail.com>
Date2016-11-05 02:49 -0700
Message-ID<76c4f89b-966c-4fcd-bdf3-3a3aec291c0a@googlegroups.com>
In reply to#9893
Dick,
Thank you for your help.
I will try, later today, adapting your code to my specific situation and let you know how it goes.
Much appreciated!
Richard Kaplan

[toc] | [prev] | [next] | [standalone]


#9898

FromSjonnie D <Sjonnied@gmail.com>
Date2016-11-07 07:03 -0800
Message-ID<04f75581-e916-48af-bf6b-3b236389df3e@googlegroups.com>
In reply to#9892
Hi Richard,
In your define bbrowser you can add an edit condition to a column. This will make it NON-editable when the condition is true.

 oEditCondition := EditCondition{'Server:TYPE<>"N"',oServer,FALSE}
 bBrowser:GetColumn(2):EditCondition:Add(oEditCondition)

To make it Red when it is not Editable:
oColorCondition := ColorCondition{'Server:TYPE<>"N"',oServer,Color{COLORRED}}
oBrowser:GetColumn(2):ColorCondition:Add(oColorCondition)

Thats all.

[toc] | [prev] | [next] | [standalone]


#9899

Fromrkaplan328 <richard.d.kaplan@gmail.com>
Date2016-11-07 14:43 -0800
Message-ID<6b6c1848-b472-4e7b-9530-5caddf9404c4@googlegroups.com>
In reply to#9898
Sjonnie,
Thank you for your excellent suggestion.  I had not been aware of the EditCondition facility which is parallel to the ColorCondition one.  So I now have two pairs of statements in the definition of column 2 in my init method:

oColorCondition := bColorCondition{{|x|x:Server:col1=1}, [color stuff] }
oColumn:ColorCondition:Add(oColorCondition)

and

oEditCondition1:=bEditCondition{{|x|x:Server:col1=1},self:oDCbBrowser1:Server,FALSE}
oColumn:EditCondition:Add(oEditCondition) 

Now this works fine when I've just made an entry in col 1, i.e., if I've entered a 1 column 2 becomes non-editable.  But when I move around the bBrowser1, the color condition on col 2 remains intact, but the edit condition seems to get lifted.  Do you have any idea what I am doing wrong?

[toc] | [prev] | [next] | [standalone]


#9900

Fromrkaplan328 <richard.d.kaplan@gmail.com>
Date2016-11-07 23:20 -0800
Message-ID<6fee7f50-a312-41c8-bb10-82ba98e5f704@googlegroups.com>
In reply to#9899
Turns out that 
bEditCondition{{|x|x:server:col1=whatever},...} does not work but
bEditCondition{     "server:col1=whatever",...} works just fine.
No similar problem with bColorCondition.

[toc] | [prev] | [next] | [standalone]


#9911

FromJoachim Bieler <support@votools.com>
Date2016-11-09 07:02 +0100
Message-ID<e8fsg0F2j0pU1@mid.individual.net>
In reply to#9900
Richard,

this should work too:

{|Server, Column, Row, RecNo| server:col1=whatever}

Regards,

Joachim Bieler



Am 08.11.2016 um 08:20 schrieb rkaplan328:
> Turns out that
> bEditCondition{{|x|x:server:col1=whatever},...} does not work but
> bEditCondition{     "server:col1=whatever",...} works just fine.
> No similar problem with bColorCondition.

[toc] | [prev] | [next] | [standalone]


#9902

FromMartin <Martin@spam.spam>
Date2016-11-08 09:12 +0000
Message-ID<nvs4s6$rau$2@dont-email.me>
In reply to#9892
Look at every sample of celledit you can find.

You will find that returning false from it will prevent editing

Celledit callback method is extremely powerful and worth fully investigating

On 05/11/2016 00:37, rkaplan328 wrote:
> I wish to make a given cell in Column 2 of my bBrowser editable non-editable (and perhaps color it differently), based on the value of the cell in the same row of Column 1.  I'm testing the value of the criterion cell in my CellEdit method, in the BEDIT_HIDE branch for Column 1, but
>
>    bBrowser:GetColumn(2):editable = .f.
>
> doesn't seem to do the trick.  And I'm not at all sure about coloring cells one-by-one.  Any suggestions?
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web