Source language: Translate to:

Listbox to article issue

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 2:24 am

So what i want is to display a .rtf file when certain words apper in the combobox, tried working code but i'm definetely missing something any ideas as i need it to go by the text of what is shown and not the number of it. Changed Variable etc

Code i am using
Code: Select all
If "[ListaDesplegable4]" "=" "Armorcraft Kit"
     ListBoxGetItem "ListBox4" "[Embedded]Armorcraft Kit.RTF" "[File6]"
Endif
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby HPW » Sat Jun 15, 2013 2:42 am

Hello,

You have a Combobox and want to select a item and then load a Rtf in a existing articel-objet based on the selection?

I would define a articel object with a dummy-rtf containing only a neobook variable [RtfContent]

In OnChange of the Combobox I would:

Code: Select all
If "[ListaDesplegable4]" "=" "Armorcraft Kit"
     FileToVar "[Embedded]Armorcraft Kit.RTF" "[RtfContent]"
Endif


Regards
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Re: Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 2:51 am

That just wont show anything for me, It doesnt give me an error though.

It should be working, To be honest its spot on, could it be because the combobox is populated by previous combobox so the selection isnt read as a variable ?
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby mishem » Sat Jun 15, 2013 3:48 am

What do you have here?

Image
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 3:49 am

I have item text selected, for listbox
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby mishem » Sat Jun 15, 2013 3:53 am

ListBoxGetItem "ListBox4" "[Embedded]Armorcraft Kit.RTF" "[File6]"
Where are highlighted in red must be a line number and not a file path.
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 3:54 am

Would this still be a Effective way if i am going to have over 800 files in listbox
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby mishem » Sat Jun 15, 2013 3:57 am

Personally, I am so kollichestvom have never come across. Perhaps you had better pay attention to the plug-in or NeoBookDB NeoBookDBPro?
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: Listbox to article issue

Postby mishem » Sat Jun 15, 2013 4:00 am

You can keep all the files in the database. And during the transition to the file will be displayed.
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 4:01 am

I thought the same thing but i Can not figure out how to add info to a database or how to get info to show depending on what i would choose from last dropdown....I am willing to learn but its just confusing
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby mishem » Sat Jun 15, 2013 4:07 am

The help are all well described. Spend some time reading it and everything will be easy.
See the section Working with images. Replace the path to the file with the image on. Rtf and specify the object Article variable.
I can not explain to you through a translator.
Show what you need and I can make you an example.
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 4:15 am

Thankyou i will look into that now
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby mishem » Sat Jun 15, 2013 4:56 am

Well, here's a quick example if I understand what you need.
Create a new project 640x480 copy the code and paste into a new project.

Code: Select all
NBW Publication Source File
(C)1993-2013 NeoSoft Corp.
Title=Безымянный проект NeoBook
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
StartupAction=dbfCreate "[PubDir]Base.dbf" "Name,String,35|Rtf_File,Picture,0" ""¶dbfShowTable "[PubDir]Base.dbf" "Rectangle1" ""¶dbfFieldToVar "[PubDir]Base.dbf" "NAME" "[ComboBox]" "NoBlanks"
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Установка
SetupColors=16711680|0|65535
Variables=[Base.Name]¶[Base.Rtf_File]¶[ComboBox]¶[ComboBox1]¶[DelResult]¶[LastDir]¶
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=Открыть
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=8
Name=Text1
X=16
Y=410
W=72
H=16
Anchor=0
Font=Arial
FontSize=8
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}Name:}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=1
ObjectType=9
Name=Name
X=88
Y=404
W=300
H=28
Anchor=0
VarName=[Base.Name]
Align=1
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=8
Name=Text2
X=16
Y=442
W=72
H=16
Anchor=0
Font=Arial
FontSize=8
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}Rtf_File:}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=0
ObjectType=9
Name=Rtf_File
X=88
Y=436
W=300
H=28
Anchor=0
VarName=[Base.Rtf_File]
Align=1
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5
ObjectType=3
Name=PushButton6
X=393
Y=434
W=91
H=32
Anchor=0
Text=Add
Align=2
ImageStyle=0
ObjAction=FileOpenBox "" "*.Rtf|*.Rtf" "[LastDir]" "[Rtf_File]" ""¶If "[Rtf_File]" "=" ""¶   Return¶   Else¶   dbfAddRecord "Base.dbf"¶   SetVar "[Base.Rtf_File]" "[Rtf_File]"¶EndIf¶¶If "[Base.Name]" "=" ""¶   ExtractFileName "[Base.Rtf_File]" "[Base.Name]"¶EndIf¶ListBoxAddItem "ComboBox1" "0" "[Base.Name]"¶dbfFirst "[PubDir]Base.dbf"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=45857723
FillPattern=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=33751811
TabOrder=6
ObjectType=3
Name=PushButton7
X=531
Y=430
W=85
H=32
Anchor=0
Text=Delite
Align=2
ImageStyle=0
ObjAction=MessageBox "Удалить" "Удалить запись?" "OK|Отменить" "[DelResult]"¶If "[DelResult]" "=" "1"¶  dbfDeleteRecord "Base.dbf"¶EndIf
LineColor=0
LineWidth=1
LineStyle=0
FillColor=45857723
FillPattern=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=33751811
TabOrder=7
ObjectType=5
Name=Rectangle1
X=7
Y=40
W=619
H=112
Anchor=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
TabOrder=8
ObjectType=11
Name=ComboBox1
X=10
Y=8
W=210
H=23
Anchor=0
Text=[ComboBox]
VarName=[ComboBox1]
VarType=0
ObjAction=dbfFind "[PubDir]Base.dbf" "NAME" "[ComboBox1]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=33751811
TabOrder=9
ObjectType=2
Name=Article1
X=7
Y=160
W=623
H=229
Anchor=0
FileName=[Base.Rtf_File]
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=204
TextColor=0
TabOrder=10
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: Listbox to article issue

Postby sheppard1 » Sat Jun 15, 2013 5:21 am

Is it possible to make it fetch file based on The name and not the order of it in the listbox

For example i would use
Code: Select all
If "[ListaDesplegable4]" "=" "Armorcraft Kit"
    ListBoxGetItem "ListBox4" "1" "[File6]"
EndIf


But would like to use
Code: Select all
If "[ListaDesplegable4]" "=" "Armorcraft Kit"
    ListBoxGetItem "ListBox4" "(name.rtf or something similar)" "[File6]"
EndIf
sheppard1
 
Posts: 25
Joined: Thu May 30, 2013 4:37 pm

Re: Listbox to article issue

Postby dpayer » Sat Jun 15, 2013 7:07 am

sheppard1 wrote:Is it possible to make it fetch file based on The name and not the order of it in the listbox




You know you can have the listbox variable return EITHER the list number of the item or the text:
Image

In either case, you can find the other (item number-->text or text--->item number)
Code: Select all
ListBoxGetItem "listboxname" "itemnumber" "[founditemtext]"

Code: Select all
ListBoxFindItem "listboxname" "founditemtext" "[itemnumber]"


I have found that it is helpful to create for yourself projects (for learning) that are less ambitious than your desired final product. Through these things, you will learn many of the tips we are sharing here. Also, study other people's code. NB scripts are pretty easy to follow. I always put comment lines in to remind myself what I was doing for a place in code that has some complication to it. You never know, you may need to do an update a year later and it is MUCH easier when you don't have to reinvent the program just to fix a simple point because you forgot what your logic process was.

Example of a project using Listboxes I did for myself in order to learn more: viewtopic.php?f=22&t=19299
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Next

Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 3 guests