Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) [Solved] Undecided (Read 2640 times)
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
[Solved] Undecided
Nov 12th, 2007 at 8:09pm
Print Post Print Post  
Sesame supports an Undecided state with checkboxes and radio buttons.  Is there a way to turn this off?  I'd like to be able to initialize the underlying data elements with default values and then only allow a user to select/delect a checkbox and have always at least on radio button item within a group selected.
« Last Edit: Jan 30th, 2008 at 2:04pm by Hammer »  
Back to top
 
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Undecided
Reply #1 - Nov 12th, 2007 at 8:45pm
Print Post Print Post  
Try the following:

If name_of_Element = 1 //Yes or True
{
// do nothing
}
Else
{
Clear(name_of_element)
}
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Undecided
Reply #2 - Nov 12th, 2007 at 8:50pm
Print Post Print Post  
You will want to put ^ that code into the On Element Immediate Change event of the Checkbox. That will give the checkbox the choices of Yes or Undecided.

If you want the choices of Yes or No, You will want the following code in the On Element Immediate Change event of the Checkbox

Code
Select All
If @IsBlank(ThisElement) Then
{
	ThisElement = 1
} 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Undecided
Reply #3 - Nov 12th, 2007 at 9:47pm
Print Post Print Post  
You will want to put ^ that code into the On Element Immediate Change event of the Checkbox. That will give the checkbox the choices of Yes or Undecided.

Modified my Notes on that subject.  Embarrassed
  
Back to top
 
IP Logged
 
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
Re: Undecided
Reply #4 - Nov 13th, 2007 at 4:31pm
Print Post Print Post  
Quote:
If you want the choices of Yes or No, You will want the following code in the On Element Immediate Change event of the Checkbox

Thanks.  However, I can't get similar code to work (using a static variable to hold the previous value) with a Radio Button Group.  The On Element Immediate Change event is not consistently(*) triggered when a Radio Button Group is set to Null (using v2.0.3).

To test, I wrote a very simple application with a Male/Female radio button with the following code in the On Element Immediate Change event:

Code
Select All
If @IsBlank( ThisElement ) Then
	WriteLn( "Gender is NULL" )
Else
	WriteLn( "Gender is: " + ThisElement ) 



(*) I say "consistently" because every so often the event would fire when the Radio Button Group was set to NULL.  I couldn't figure out the pattern though.
  
Back to top
 
IP Logged
 
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
Re: Undecided
Reply #5 - Jan 30th, 2008 at 1:05am
Print Post Print Post  
Quote:
You will want to put ^ that code into the On Element Immediate Change event of the Checkbox. That will give the checkbox the choices of Yes or Undecided.

If you want the choices of Yes or No, You will want the following code in the On Element Immediate Change event of the Checkbox

Code
Select All
If @IsBlank(ThisElement) Then
{
	ThisElement = 1
} 



-Ray

This code does not work for unbound checkboxes.

(Cross-posted to Lantica Online Support Request)
  
Back to top
 
IP Logged
 
olddog
Member
*
Offline



Posts: 35
Joined: Jan 19th, 2008
Re: Undecided
Reply #6 - Jan 30th, 2008 at 1:25am
Print Post Print Post  
i have found the following code to work with an unbound check box to have the choice between true and false.
i believe i originally found it somewhere in the forum

in the global code:

stat cb_state as int = -1

in check box on immediate change

f cb_state = 1 then
{
     thiselement = 0
}
else
{
     thiselement = 1
}
cb_state=thiselement
  

trying to learn a new trick
Back to top
 
IP Logged
 
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
Re: Undecided
Reply #7 - Jan 30th, 2008 at 2:27am
Print Post Print Post  
olddog wrote on Jan 30th, 2008 at 1:25am:
i have found the following code to work with an unbound check box to have the choice between true and false.

Much obliged!  Works like a champ.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: [Solved] Undecided
Reply #8 - Jan 30th, 2008 at 2:25pm
Print Post Print Post  
If you don't want the extra static variable, this works fine for me On Element Immediate Change of an unbound checkbox.

Code
Select All
If ThisElement <> 0
{
	ThisElement = 1
}
ForceRedraw()

 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: [Solved] Undecided
Reply #9 - Jan 30th, 2008 at 5:05pm
Print Post Print Post  
Quote:
If you want the choices of Yes or No, You will want the following code in the On Element Immediate Change event of the Checkbox
Code
Select All
If @IsBlank(ThisElement) Then
{
	ThisElement = 1
}  



Ray, I'm having a little trouble understanding this. 

If I'm reading your code right, it seems to say "If the element is immediately cleared, turn it back on (yes)".  So either I'm reading it wrong or I'm just confused about states.  Or both.

I have the following code in my checkboxes OEIC, from a previous thread.
Code
Select All
// Only allows a YES checkbox toggle (clears it if NO)

IF ThisElement <> 1
THEN
	{
	Clear(ThisElement)
	} 



What I'm trying to do is, if a user unchecks a box he makes it "No".  I'm assuming that the default value for all boxes, before any checking or unchecking, is "No".  What I want is for all my boxes to be "No" unless checked.

Help with understanding this would be appreciated.  I apologize if I've derailed the thread, as I know the original poster had a different objective.  Thanks!
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: [Solved] Undecided
Reply #10 - Jan 30th, 2008 at 7:48pm
Print Post Print Post  
Hello Scott,

By default a Check box will be Blank also known as the unset state. The order of toggling states is as follows

Blank(Raised Box)
On(Down Box with a Check)
Off(Down Box with no Check)

And then back again to Blank. My code says that if we reach the Blanked state go straight to the On State.
So it goes like the following starting from On

Click
Programming Runs. Nothing Happens
Off
Click
Programming Runs. Element is Blank now so Value is set to One
On
Click
Programming Runs. Nothing Happens
Off
Click
Programming Runs. Element is Blank now so Value is set to One
On
etc. etc.

So it limits it to the choices of On and Off.

Your Code says that if the value of the check box is anything other than One, clear it. So when it reaches the Off State(which comes right after On as you can see from the list above) it flips to the Blanked state. So it goes like the following starting from On


Click
Programming Runs. Element is Off which is Not equal to One so Element is Blanked
Blank
Click
Programming Runs. Nothing Happens
On
Click
Programming Runs. Element is Off which is Not equal to One so Element is Blanked
Blank
Click
Programming Runs. Nothing Happens
On

Does that help?

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: [Solved] Undecided
Reply #11 - Jan 31st, 2008 at 5:13pm
Print Post Print Post  
Quote:
Does that help?

A little but I'm still not there.

Let's say I want to search records using = and /=.  Which two states am I searching for?  I'm pretty sure if I search using /= I will get 1/Yes/On.  Which state will = find?  Because that's the state I want to set it to if it's unchecked.

Thanks Ray.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: [Solved] Undecided
Reply #12 - Jan 31st, 2008 at 6:16pm
Print Post Print Post  
I've discovered I cannot use = or /= to search check boxes, I can only toggle a state.  Checking it retrieves all those records that are checked.  Unchecking it (no) retrieves no records at all.  However, leaving it blank retrieves ALL records, both checked and unchecked.

I have decided I dislike tri-state boolean elements, as they're a pain in the a$$.
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: [Solved] Undecided
Reply #13 - Jan 31st, 2008 at 7:23pm
Print Post Print Post  
Infinity wrote on Jan 31st, 2008 at 6:16pm:
I've discovered I cannot use = or /= to search check boxes, I can only toggle a state.  Checking it retrieves all those records that are checked.  Unchecking it (no) retrieves no records at all.  However, leaving it blank retrieves ALL records, both checked and unchecked.

I have decided I dislike tri-state boolean elements, as they're a pain in the a$$.



That is because you are trying to use the Blank as the Off in them. If the records that are not On were actually set to be Off then the Searching would work the way that you want it to. Off would retrieve Off, On would retrieve On and Unset would retrieve everything.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
MP
Full Member
***
Offline



Posts: 104
Joined: Sep 3rd, 2007
Re: [Solved] Undecided
Reply #14 - Jan 31st, 2008 at 7:56pm
Print Post Print Post  
Infinity wrote on Jan 31st, 2008 at 6:16pm:
I have decided I dislike tri-state boolean elements, as they're a pain in the a$$.

NULLs.  You either love 'em or hate 'em.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print