Normal Topic FormNotifyForm Question (Read 675 times)
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
FormNotifyForm Question
Apr 3rd, 2006 at 4:07am
Print Post Print Post  
I have noticed that if FormNotifyForm is set to 2 in one event, and also set to 1 in another, @FormNotifyForm returns 3.

I guess that makes sense, but when I see a 3, the manual tells me I should expect it to mean "Allow save, prohibit record retreat". How can I determine that 3 means one "2" setting and one "1" setting?

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormNotifyForm Question
Reply #1 - Apr 3rd, 2006 at 11:44am
Print Post Print Post  
Quote:
I have noticed that if FormNotifyForm is set to 2 in one event, and also set to 1 in another, @FormNotifyForm returns 3.

I guess that makes sense, but when I see a 3, the manual tells me I should expect it to mean "Allow save, prohibit record retreat". How can I determine that 3 means one "2" setting and one "1" setting?



@FormNotifyForm and @NotifyForm return the actual "flag set" in binary:

1 = 00000001 ; flag one set
2 = 00000010 ; flag two set
3 = 00000011 ; both flag one and two set

To check for values as set by either NotifyForm or FormNotifyForm, you should use @FormIsNotifyForm or @IsNotifyForm.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: FormNotifyForm Question
Reply #2 - Apr 3rd, 2006 at 12:31pm
Print Post Print Post  
Quote:
use @FormIsNotifyForm or @IsNotifyForm

Thanks, Mark. That was easy.

Now that you point it out, I see it is listed right above NotifyForm on page 36 of the programming guide. I was using the logic of:  If I use NotifyForm to set a value, I should simply use the same name with an "@" symbol in front of it (@NotifyForm) to check for that value. Roll Eyes

I see now that I should have at least been checking to see if @NotifyForm() > 0, rather than if @NotifyForm() = 1. But @IsNotifyForm is even more appropriate for what I want.

Thanks again. Smiley
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormNotifyForm Question
Reply #3 - Apr 3rd, 2006 at 1:30pm
Print Post Print Post  
Quote:
Thanks, Mark. That was easy.

Now that you point it out, I see it is listed right above NotifyForm on page 36 of the programming guide. I was using the logic of:  If I use NotifyForm to set a value, I should simply use the same name with an "@" symbol in front of it (@NotifyForm) to check for that value. Roll Eyes

I see now that I should have at least been checking to see if @NotifyForm() > 0, rather than if @NotifyForm() = 1. But @IsNotifyForm is even more appropriate for what I want.

Thanks again. Smiley


NotifyForm(n) tells Sesame to set the n'th flag, combining (boolean OR'd together) it with any that have already been set.

@NotifyForm() asks Sesame which flags, in combination, have been set - returning the sum (boolean OR'd value).

@IsNotifyForm asks Sesame if a particular (and singular) flag has been set (boolean AND).

So NotifyForm and @NotifyForm are actually the complements of one another, even though NotifyForm and @IsNotifyForm share the same numeric notation.

To decode the results from @NotifyForm:

NotifyForm(1) = 00000001 = 1 ; post disabled
NotifyForm(2) = 00000010 = 2 ; advance disabled
NotifyForm(3) = 00000100 = 4 ; retreat disabled
NotifyForm(4) = 00001000 = 8 ; delete disabled
NotifyForm(5) = 00010000 = 16 ; remove disabled
NotifyForm(6) = 00100000 = 32 ; escape disabled

For Sesame 2.0:
NotifyForm(7) = 01000000 = 64 ; extend mode disabled

These, of course, are combined to disable multiple things at once. So if you have 24, that means that delete and remove are both disabled (8 + 16). If you have 35 than means that post, advance, and escape are disabled (1 + 2 + 32). Etc...
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: FormNotifyForm Question
Reply #4 - Apr 3rd, 2006 at 11:52pm
Print Post Print Post  
Well all this binary stuff got me thinking. Unlike most Basics, SBasic doesn't have any binary operators or functions - so I added the following for Sesame 2.0:

BAnd(one as int, two as int) as int
BOr(one as int, two as int) as int
BXOr(one as int, two as int) as int
BNot(one as int) as int
BShiftLeft(one as int, two as int) as int
BShiftRight(one as int, two as int) as int
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: FormNotifyForm Question
Reply #5 - Apr 4th, 2006 at 3:01am
Print Post Print Post  
Sesame 2.0 just seems to keep getting better. 8)
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged