ListBox Quandary

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Locked
TMcD
Posts: 239
Joined: Sun Apr 10, 2005 11:20 am

ListBox Quandary

Post by TMcD »

I'm using a variable for the ListBox choices...

Example:
[FruitChoices] = Apple[#13]Peach[#13]Orange

Variable: (to store selected item) = [FruitSelected]

When I set [FruitSelected] to [FruitSelected] = Apple (so the field starts there and isn't blank), it does not update the ListBox to show Apple. I've even tried a refereshobject command.

Is there some other way to set a ListBox when using a variable as the choices?

Thanks
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: ListBox Quandary

Post by Gaev »

TMcD:

I have a ListBox named ListBox2 ... its List Items: property is defined as [Fruits.

I placed this code in my PageEnter event section ...

Code: Select all

SetVar "[Fruits]" "Apple[#13]Banana[#13]Cherry[#13]Date"
SetVar "[ListBox2]" "Cherry"
... and it ...

a) displays all the entries
b) highlights the "Cherry" entry.

1) Are you using a ListBox and not a ComboBox ?

2) Where is your code placed ?

3) Using the Debugger, can you verify that the variables have the expected values ?
TMcD
Posts: 239
Joined: Sun Apr 10, 2005 11:20 am

Re: ListBox Quandary

Post by TMcD »

Gaev,

1. Yes, it's a ListBox.
2. It is placed initially in the Page Enter to set it. And also placed in the selection changed.
3. Things look right....

Bigger breakdown, because answer #2 might confuse you.

The first ListBox is used to select Fruit. Apple Peach Orange [FruitChoices]

If "[FruitChoices]" "=" "Apple"
SetVar "[QuantityChoices]" "1 Dozen[#13]2 Dozen[#13]3 Dozen"
EndIf

If "[FruitChoices]" "=" "Peach"
SetVar "[QuantityChoices]" "1 Dozen[#13]2 Dozen[#13]3 Dozen[#13]4 Dozen"
EndIf

If "[FruitChoices]" "=" "Orange"
SetVar "[QuantityChoices]" "1 Dozen[#13]2 Dozen"
EndIf

The second ListBox displays [QuantityChoices], the variable to store the selected item is [QuantitySelected]. When I set [QuantitySelected] = 1 Dozen, it doesn't display in the second ListBox.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: ListBox Quandary

Post by Gaev »

TMcD:
The second ListBox displays [QuantityChoices], the variable to store the selected item is [QuantitySelected]. When I set [QuantitySelected] = 1 Dozen, it doesn't display in the second ListBox.
I don't see where you "set [QuantitySelected] = 1 Dozen" ... is it via code or mouse click ?

Perhaps, when repopulating [QuantityChoices], the second ListBox assumes that "1 Dozen" is the initial choice ... hence, when you set it, it does not consider it a change ... temporarily, try and choose "2 Dozen".
TMcD
Posts: 239
Joined: Sun Apr 10, 2005 11:20 am

Re: ListBox Quandary

Post by TMcD »

Gaev wrote:TMcD:
The second ListBox displays [QuantityChoices], the variable to store the selected item is [QuantitySelected]. When I set [QuantitySelected] = 1 Dozen, it doesn't display in the second ListBox.
I don't see where you "set [QuantitySelected] = 1 Dozen" ... is it via code or mouse click ?

Perhaps, when repopulating [QuantityChoices], the second ListBox assumes that "1 Dozen" is the initial choice ... hence, when you set it, it does not consider it a change ... temporarily, try and choose "2 Dozen".
[QuantitySelected] = 1 Dozen is set when the app is started.

"1 Dozen" never shows up as the initial choice (which I think is odd).
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: ListBox Quandary

Post by Gaev »

TMcD:
[QuantitySelected] = 1 Dozen is set when the app is started.

"1 Dozen" never shows up as the initial choice (which I think is odd).
Aha ... when you repopulate [QuantityChoices], then [QunatitySelected] probably get cleared out ... try ...

Code: Select all

If "[FruitChoices]" "=" "Apple"
SetVar "[QuantityChoices]" "1 Dozen[#13]2 Dozen[#13]3 Dozen"
EndIf

If "[FruitChoices]" "=" "Peach"
SetVar "[QuantityChoices]" "1 Dozen[#13]2 Dozen[#13]3 Dozen[#13]4 Dozen"
EndIf

If "[FruitChoices]" "=" "Orange"
SetVar "[QuantityChoices]" "1 Dozen[#13]2 Dozen"
EndIf

SetVar "[QuantitySelected]" "1 Dozen"
... i.e. AFTER you repopulate [QuantityChoices].
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: ListBox Quandary

Post by virger »

Quiza ayude, a mi me funciona.
Selecciopna en la ventana opuesta la relacion de uno a muchos de muchos a uno

Maybe it helps, it works for me.
Select in the opposite window the relationship of one to many many to one

Code: Select all

NBW Publication Source File
(C)2016 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,80
ScreenColors=16777216
ScreenWidth=465
ScreenHeight=470
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=28
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=10
Name=LsA
X=5
Y=37
W=110
H=235
Anchor=0
Text=Uno-1¶Dos-2¶Tres-3¶Cuatro-4¶Cinco-5¶Diez-10¶Once-11
VarName=[vA]
VarType=0
MultiSelect=Yes
XPTheme=Yes
ObjAction=SetVar "[vB]" ""¶SetVar "[Sep]" "[#13]"¶¶SearchStr "[vA]" "Uno-1.Tres-3.Cinco-5.Once-11" "[Ps]" ""¶if "[Ps]" ">" "0"¶    GotoLine "[vA]"¶:Uno-1¶   SetVar "[vB]" "1.Alfa[sep]2.Beta[sep]3.Gama"¶   gotoline "Siga"¶¶:Tres-3¶   SetVar "[vB]" "2.Beta[sep]3.Gama[sep]4.Delta"¶   gotoline "Siga"¶   ¶:Cinco-5¶   SetVar "[vB]" "8.Zeta[Sep]6.Omega[sep]4.Delta[sep]4.Delta[Sep]2.Beta"¶   gotoline "Siga"¶¶:Once-11¶   SetVar "[vB]" "1.Alfa[Sep]2.Beta[sep]3.Gama[sep]4.Delta[Sep]5.Theta[Sep]6.Omega[Sep]8.Zeta"¶   gotoline "Siga"¶   ¶else¶   ListBoxFindItem "LsA" "[vA]" "[Ps]"¶   ListBoxGetItem "LsB" "[Ps]" "[vB]"¶endif¶:Siga
LineColor=0
LineWidth=2
LineStyle=0
FillColor=13687032
FillPattern=0
FillMode=Yes
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5
ObjectType=10
Name=LsB
X=118
Y=37
W=110
H=235
Anchor=0
Text=1.Alfa¶2.Beta¶3.Gama¶4.Delta¶5.Theta¶6.Omega¶8.Zeta
VarName=[vB]
VarType=0
MultiSelect=Yes
XPTheme=Yes
ObjAction=strparse "Uno-1,1.Alfa[sep]2.Beta[sep]3.Gama:Tres-3,2.Beta[sep]3.Gama[sep]4.Delta:Cinco-5,8.Zeta[sep]6.Omega[sep]4.Delta[sep]2.Beta:Once-11,1.Alfa[Sep]2.Beta[sep]3.Gama[sep]4.Delta[Sep]5.Theta[Sep]6.Omega[Sep]8.Zeta" ":" "[Set]" "[Xx]"¶¶setvar "[Zet]" ""¶loop "1" "[Xx]" "[C]"¶   SearchStr "[vB]" "[Set[C]]" "[Ps]" ""¶   If "[Ps]" ">" "0"¶      strparse "[Set[C]]" "," "[Tmp]" "[x]"¶      setvar "[Zet]" "[Zet][Tmp1][Sep]"¶      setvar "[Tmp1]" ""¶      setvar "[Tmp2]" ""¶   EndIf¶   .setvar "[Set[C]]" ""¶endloop¶setvar "[vA]" "[Zet]"¶.setvar "[Zet]" ""
LineColor=0
LineWidth=2
LineStyle=0
FillColor=14743776
FillPattern=0
FillMode=Yes
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=10
Name=LA
X=237
Y=230
W=110
H=235
Anchor=0
Text=Uno-1¶Dos-2¶Tres-3¶Cuatro-4¶Cinco-5¶Diez-10¶Once-11
VarName=[vA]
VarType=1
MultiSelect=Yes
XPTheme=Yes
ObjAction=SetVar "[vB]" "[Pt[vA]2]"
LineColor=0
LineWidth=2
LineStyle=0
FillColor=14743776
FillPattern=0
FillMode=Yes
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=10
Name=LB
X=351
Y=230
W=110
H=235
Anchor=0
Text=1.Alfa¶2.Beta¶3.Gama¶4.Delta¶5.Theta¶6.Omega¶8.Zeta
VarName=[vB]
VarType=1
MultiSelect=Yes
XPTheme=Yes
ObjAction=SetVar "[vA]" "[Zet[vB]]"
LineColor=0
LineWidth=2
LineStyle=0
FillColor=13687032
FillPattern=0
FillMode=Yes
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=BtSet2
X=317
Y=192
W=65
H=32
Anchor=0
Text=Set
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=SetVar "[vB]" ""¶StrParse "1,1[sep]3[sep]5:2,2[sep]4[sep]6:3,1[sep]2[sep]3[sep]4[sep]5" ":" "[Set]" "[N]"¶Loop "1" "[N]" "[C]"¶     StrParse "[Set[C]]" "," "[Pt[C]]" "[x]"¶     StrParse "[Pt[C]2]" "[Sep]" "[Px[C]]" "[X]"¶     SetVar "[Set[C]]" ""¶     Loop "1" "[X]" "[I]"¶         SetVar "[Zet[Px[c][I]]]" "[Zet[Px[c][I]]][Pt[C]1][sep]"¶         SetVar "[Px[C][I]]" ""¶     EndLoop¶EndLoop¶ClearVariables "[X],[I],[C]"
LineColor=0
LineWidth=2
LineStyle=0
FillColor=13487565
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=7
ObjectType=3
Name=BtSet1
X=85
Y=4
W=65
H=32
Anchor=0
Text=Set
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=SetVar "[vA]" ""¶SetVar "[vB]" ""¶SetVar "[Sep]" "[#13]"
LineColor=0
LineWidth=2
LineStyle=0
FillColor=13487565
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=6
ObjectType=8
Name=Inf1
X=270
Y=65
W=168
H=30
Anchor=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0 Usando "\plain\f0\fs24\cf0\b\ul\i ITEM TEXT\plain\f0\fs24\cf0 "}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=13487565
FillPattern=1
TabOrder=10
ObjectType=7
Name=Line1
X1=232
Y1=79
X2=266
Y2=79
EndCaps=1
LineColor=0
LineWidth=7
LineStyle=0
FillColor=13487565
FillPattern=1
TabOrder=11
ObjectType=8
Name=Inf2
X=9
Y=333
W=189
H=30
Anchor=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\qr\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0 Usando "\plain\f0\fs24\cf0\b\ul\i ITEM NUMBER\plain\f0\fs24\cf0 "}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=13487565
FillPattern=1
TabOrder=8
ObjectType=7
Name=Line2
X1=202
Y1=347
X2=236
Y2=347
EndCaps=512
LineColor=0
LineWidth=7
LineStyle=0
FillColor=13487565
FillPattern=1
TabOrder=9
COSTA RICA
PURA VIDA
TMcD
Posts: 239
Joined: Sun Apr 10, 2005 11:20 am

Re: ListBox Quandary

Post by TMcD »

Thanks to all for your suggestions, and sorry for taking a bit to respond, school started for the kids, so it's been busy. :)

I now realized there is a bug in NeoBook, which has set this whole discussion in the wrong direction.

Since I had renamed all my fields, instead of the default names. (I do this to help me in the future for updating and understanding what's what...) :)

So I originally said I was using a ListBox, it turns out it's a ComboBox. (Sorry Gaev, but I blame NeoBook for this.) :lol:

Since I had renamed it, I had opened it to see what it was (if you look in the upper left of the properties area), it says:

List Box Properties - Fruits

I would expect it to say:

Combo Box Properties - Fruits

The way I call tell it's a ComboBox is by looking at the Object List icon, which glancing quickly doesn't work, I have to take a second and look at the difference between the ComboBox and the ListBox icons.

I'll be sending NeoSoftware an email. I really think it should read ComboBox because that's what it is. :)

I think I have found a workaround, but it doesn't make sense exactly why it works. I'll post about that, right now I have to get back to work. :)
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: ListBox Quandary

Post by Gaev »

TMcD:

I created a ComboBox (the one that normally shows just one (selected) item at a time, but drops down to show others) ... its items are defined as contained in variable [Combo2Items] and its variable to contain the selected item is defined as [ComboBox2].

I placed this code in the PageEnter code section ...

Code: Select all

SetVar "[Combo2Items]" "Apple[#13]Banana[#13]Cherry[#13]Date"
SetVar "[ComboBox2]" "Cherry"
... everything works as expected.

if you are experiencing different results, try and replicate what I described in a new Pub ... describe in detail how what you get is different from expectations.
TMcD
Posts: 239
Joined: Sun Apr 10, 2005 11:20 am

Re: ListBox Quandary

Post by TMcD »

Ok, so I decided to make an example using the exact same code, and the workaround.

To clarify, this is used for selecting a date. (I used the fruit example originally to help keep things simple.) I also removed the full 12 month, to keep the code small.

The "Original Code" example you'll see will work once, then it won't show a date when you change the month.
The "Workaround" works as I expect it should, but it's what I call a "workaround".

Take a look and maybe point out why my thinking "Original Code" is flawed... ???

Code: Select all

NBW Publication Source File
(C)2016 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5.80
ScreenColors=16777216
ScreenWidth=640
ScreenHeight=480
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=11
Name=OTCMonth
X=46
Y=66
W=114
H=26
Anchor=0
Text=September¶October¶November¶December
VarName=[OTCMonth]
VarType=0
ObjAction=If "[OTCMonth]" "=" "September"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30"¶GotoLine "EndOfDateChoices"¶EndIf¶¶If "[OTCMonth]" "=" "October"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30[#13]31"¶GotoLine "EndOfDateChoices"¶EndIf¶¶If "[OTCMonth]" "=" "November"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30"¶GotoLine "EndOfDateChoices"¶EndIf¶¶If "[OTCMonth]" "=" "December"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30[#13]31"¶GotoLine "EndOfDateChoices"¶EndIf¶¶¶:EndOfDateChoices¶.. We need to show the loaded in date or a default date of 1.¶.SetVar "[OTCDate]" ""¶Delay "250"¶SetVar "[OTCDate]" "[DayNum]"
LineColor=8421504
LineWidth=1
LineStyle=0
FillColor=14013909
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=11
Name=OTCDate
X=164
Y=66
W=53
H=26
Anchor=0
Text=[DateChoices]
VarName=[OTCDate]
VarType=1
LineColor=8421504
LineWidth=1
LineStyle=0
FillColor=14013909
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5
ObjectType=11
Name=ComboBox3
X=426
Y=66
W=114
H=26
Anchor=0
Text=September¶October¶November¶December
VarName=[OTCMonth2]
VarType=0
ObjAction=If "[OTCMonth2]" "=" "September"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30"¶GotoLine "EndOfDateChoices"¶EndIf¶¶If "[OTCMonth2]" "=" "October"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30[#13]31"¶GotoLine "EndOfDateChoices"¶EndIf¶¶If "[OTCMonth2]" "=" "November"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30"¶GotoLine "EndOfDateChoices"¶EndIf¶¶If "[OTCMonth2]" "=" "December"¶SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30[#13]31"¶GotoLine "EndOfDateChoices"¶EndIf¶¶¶:EndOfDateChoices¶.. We need to show the loaded in date or a default date of 1.¶SetVar "[OTCDate2]" ""¶Delay "250"¶SetVar "[OTCDate2]" "[DayNum]"
LineColor=8421504
LineWidth=1
LineStyle=0
FillColor=14013909
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=11
Name=ComboBox4
X=544
Y=66
W=53
H=26
Anchor=0
Text=[DateChoices]
VarName=[OTCDate2]
VarType=1
LineColor=8421504
LineWidth=1
LineStyle=0
FillColor=14013909
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=8
Name=Text1
X=46
Y=30
W=110
H=26
Anchor=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0 Original Code}}}
HMargin=2
VMargin=2
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=14013909
FillPattern=1
TabOrder=7
ObjectType=8
Name=Text2
X=426
Y=33
W=110
H=26
Anchor=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0 Workaround}}}
HMargin=2
VMargin=2
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=14013909
FillPattern=1
TabOrder=6
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: ListBox Quandary

Post by Gaev »

TMcD:

It is NOT a workaround ... that is how you are supposed to code it ... whenever you replace the contents (entries within) of the ListBox, the current selection is shown as empty (unselected) ... however, the Variable to store the selection is left unchanged (as the same variable could be used elsewhere in the pub).

As for setting the day-of-month via script, if you intended to always set it (via script) to [DayNum], please note that it will cause problems when your App is run on the 31 st day of a month and the user chooses February (or a month with just 30 days).
TMcD
Posts: 239
Joined: Sun Apr 10, 2005 11:20 am

Re: ListBox Quandary

Post by TMcD »

Gaev wrote:TMcD:

It is NOT a workaround ... that is how you are supposed to code it ... whenever you replace the contents (entries within) of the ListBox, the current selection is shown as empty (unselected) ... however, the Variable to store the selection is left unchanged (as the same variable could be used elsewhere in the pub).

As for setting the day-of-month via script, if you intended to always set it (via script) to [DayNum], please note that it will cause problems when your App is run on the 31 st day of a month and the user chooses February (or a month with just 30 days).
Hey Gaev,

Please keep in mind my mistake, this is a ComboBox, not a ListBox.

Here is the difference between the two codes (Original and Workaround):

... Original Code
SetVar "[OTCDate]" "[DayNum]"

... Workaround Code
SetVar "[OTCDate2]" ""
SetVar "[OTCDate2]" "[DayNum]"

What doesn't make sense to me is that setting the [OTCDate] to [DayNum] should set it, and it should display. But it doesn't (Original Code).

When I empty/clear the variable and then set it (which seems like an unnecessary step) it works. (Workaround).

The above it what's confusing me, Why does "clearing" a variable before I set it to what I need, working, when setting it to what I need (as in the Original Code), should set the variable without having to clear it?

----- ----- -----

Thanks for the February concern. I have that taken care of, I just limited the months in the example to make it a smaller "demo".
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: ListBox Quandary

Post by Gaev »

TMcD:
What doesn't make sense to me is that setting the [OTCDate] to [DayNum] should set it, and it should display. But it doesn't (Original Code).
One more time ...

a) when you alter the "choices" in the ComboBox, by default, it displays a blank (i.e. no current selection) ... and the "variable to store selected item" does NOT get cleared by NeoBook.

b) when you set [OTCDate] to [DayNum], the value of OTCDate remains the same (today's day of the month) ... so SelectionChanged event of OTCDate does NOT get invoked ... and the display remains the same (blank)

Try this scenario ... before you change the month, select (with your mouse) the date to something other than today ... then change the month ... voila, the date is shown as that of today !!!
When I empty/clear the variable and then set it (which seems like an unnecessary step) it works. (Workaround).

At the risk of repeating myself, this variable could be used elsewhere in the pub.
The above it what's confusing me, Why does "clearing" a variable before I set it to what I need, working, when setting it to what I need (as in the Original Code), should set the variable without having to clear it?
It is good programming practice to "clear" the value whenever you alter the selection of entries (in case the current stored value is not being offered in the altered set of entries) e.g. ...

Code: Select all

SetVar "[OTCDate]" ""

If "[OTCMonth]" "=" "September"
SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30"
EndIf

If "[OTCMonth]" "=" "October"
SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30[#13]31"
EndIf

If "[OTCMonth]" "=" "November"
SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30"
EndIf

If "[OTCMonth]" "=" "December"
SetVar "[DateChoices]" "1[#13]2[#13]3[#13]4[#13]5[#13]6[#13]7[#13]8[#13]9[#13]10[#13]11[#13]12[#13]13[#13]14[#13]15[#13]16[#13]17[#13]18[#13]19[#13]20[#13]21[#13]22[#13]23[#13]24[#13]25[#13]26[#13]27[#13]28[#13]29[#13]30[#13]31"
EndIf

SetVar "[OTCDate]" "[DayNum]"
Note: I also took out the GoToLine commands ... not needed here (as the only one IfF/EndIf block will ever be true) ... also, Go To commands have been excluded from all languages (that I know of) for the last twenty years ... they used to be the root cause of confusion (a.k.a Spaghetti Code) and errors.
Locked