[AccessD] SysCmd constant conflict

Stuart McLachlan stuart at lexacorp.com.pg
Sun Aug 17 17:03:35 CDT 2003


On 17 Aug 2003 at 16:47, Susan Harkins wrote:

> > 'acObjStateOpen  The object is open  1
> > 'acObjStateNew   The object is new   4
> 
> Good guess, but I don't think so. 

I do think so. 

>Why would they double-cover a new object
> like that -- I mean there's no such thing as a closed new object, right? New
> implies unsaved. 

The fact that there is no such thing as a closed new object is 
irrelevant. These constants represent states and you will frequently 
have more than on such state applicable at the same time.  

It is just a case different bits being set as flags for the various 
states. So adding up the bit flags you get the following possible 
states.

Closed =0
Open old unchanged = 1
Open old dirty  = 3  (1 + 2)
Open new unchanged = 5  (1 + 4)
Open new dirty = 7  (4 + 1 + 2)

If you want to know whether about a particular state, you need to 
mask that bit in the return value and ignore all the other bits. If 
you want to know whether an object is Open, you just check whether 
the first bit is set  (Open = ReturnValue AND 1) if you want to know 
whether it is dirty, you check the third bit (Dirty = ReturnValue AND 
4).

>And 7 showed up with a new object where I changed a default
> property -- if it were new and unsaved, that would be 4 and 2 = 6.
> 

No, as you said above, it must also be open. (New = 4) + (Open = 1) + 
(Dirty = 2) = 7


 
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list