I can even suggest the Names[:p] EditModeEnabled Boolean DefaultEditMode Boolean Wouldn’t it be nice if you just could set a property on any form and woops they would become non editable and a edit button popped up from noware… I keep doing this change to customer,Vendor,Item GL Account list & Card, then in many many “supportive tables” list boxes…like “Payment Terms” etc… Anyone who has some smart ideas forhandeling this in general…?
Yes it would be nice, but there are more important things that I would prefer. I generally modify most List forms with this code … OnOpenForm() IF CurrForm.LOOKUPMODE THEN CurrForm.EDITABLE(FALSE);
and add a button with this OnPush() CurrForm.EDITABLE(TRUE);
this way users don’t accidently change things when doing a lookup. The thing is, it can be done, so we can live with it. More important are properties that can’t be changed in code. I would much rather that every Form property was also a function, and that what works on forms, worked on reports.
If you cannot put code in forms you can also use the InlineEditing property, this requires a F2 before the form becomes editable.
quote:
…I generally modify most List forms with this code … OnOpenForm() IF CurrForm.LOOKUPMODE THEN CurrForm.EDITABLE(FALSE);
Originally posted by David Singleton - 2005 Sep 29 : 21:07:02
A “nicer” syntax is OnOpenForm() CurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE);
I do not agree, sorry. The code devided into 2 lines is more readable, also you do not need to change the editable property always. Of the lookupmode is false, it has no use in changing the property, the second option does this. Sometimes it is better write more code in order to maintain readability.
Well something that you all probably forgot about this code is that if there is not recrod the Form becomes disabled and cripled. So you should test and see if there are any records before running the code. CurrForm.EDITABLE(NOT CurrForm.LOOKUPMODE); Btw. This is a rookie mistake.
And WHY do they not change the calls to variables of type dialog so they are automatically supressed when GUIALLOWED is FALSE. Then we didn’t have to change that when using code with NAS
Anfinnur, your code is completely different to mine, and does a different thing. The code I am using will set the form to be non editable if the form is in lookup mode. Your’s in addition to that will force the form to be editable if it is not in lookup mode, which is not what I want, since there are other conditions that also could make the form non editable. In fact I did originally have the code as you show, but it did cause issues on a few forms. Ahmed, I’m not sure I see your point. I’ve installed this on many systems, and seen it running at least 8 years on systems without coming across the issue you mention?
I guess David you’ve been very lucky and your customers’ tables had data in them at all times.
Try it… [:D]
try what? that the form becomes unusable if there is no records in it? Even your button becomes unusable, if there is no records in the form. So you can’t press the button.
No I mean “Try It”, put this code in a form, delete all the records, and you will see that it works fine.[:D]
I did it again just to make sure they haven’t changed in 4.0, and it’s the same result. The form i used is 5909 Service Item Group On OpenForm added your code. I added a new button. and on push added your code. From the Item card I clicked the lookup button and the form is disabled. The buttons are all disabled. So onpush on the new button doesn’t work. Have you tried it?