Fill a listbox

Discussions related to Visual Prolog
daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Fill a listbox

Unread post by daveplummermd » 6 Mar 2018 2:46

How do I fill a list box with a string list, or even a single item?

I have many successful projects in visual prologue 5.2. I'm trying to take on 8.1 without any experience with intervening versions. This is quite the learning curve. I have created a list box, I have its name, ID, property value sheet... All that stuff. I am simply trying to add a single string to that list box akin to the 5.2 "lbox_add(win,string)"

I appreciate any help with this, the more global question may be: is there reference that allows me to quickly find standard VIP 5.2 predicates equivalents in the 8.1?

Thanks so much in advance

Dave Plummer MD
Dave Plummer

Harrison Pratt
VIP Member
Posts: 293
Joined: 5 Nov 2000 0:01

Re: Fill a listbox

Unread post by Harrison Pratt » 6 Mar 2018 4:52

The listbox and other controls are objects that you can populate, clear and otherwise modify like this:

Code: Select all

                listbox_ctl_ACIVITYYEARS:clearAll(),                 listbox_ctl_ACIVITYYEARS:addList( YrStrList ),  % YrStrList is a string_list of years here, for example                 listbox_ctl_ACIVITYYEARS:setFocus().
It helps if you have the IDE set the Representation of the control in the dialog/form as Fact Variable instead of Variable.

For the example above, the IDE will create the following facts:

Code: Select all

% This code is maintained automatically, do not update it manually. 08:50:45-22.11.2017 facts     ok_ctl : button.     cancel_ctl : button.     listbox_ctl_ACIVITYYEARS : listBox.     staticText_ctl : textControl.
The functionality you need is documented in Interface listControl in the help file. Search in the help file for "Interface listControl."

-----------

See this for conversion notes (there may be one for VP8 that I don't know of): https://wiki.visual-prolog.com/index.ph ... l_Prolog_5

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Fill a listbox

Unread post by daveplummermd » 6 Mar 2018 11:04

Thank you kindly for the rapid and helpful response.

Also, thank you for the URL containing the table of 5.x to 8.1 conversions.

My question is, how would I have found your answer. The table that you sent me does not have any listbox functions. There does not seem to be any CNTRL-Shift-V activated dialog box for guidance. To become familiar with available actions and predicates this one just have to plow through the PFC files?

Thanks in advance
Dave Plummer MD
Dave Plummer

Harrison Pratt
VIP Member
Posts: 293
Joined: 5 Nov 2000 0:01

Re: Fill a listbox

Unread post by Harrison Pratt » 6 Mar 2018 12:23

If you have downloaded the Examples you can find some prototypic guidance in the listDemo project there.

I've had to do a lot of plowing out here in Iowa! One of the agricultural implements I use is a grep tool (AstroGrep) that enables me to search the Examples for sample usage and see a adjacent few lines of context. Using that to search the pfc folder has been helpful when the help files don't help, too.

Another helpful tip is to use Google Advanced Search (https://www.google.com/advanced_search) to search the visual-prolog.com Site or domain. That brings up more items that the searches provided by PDC.

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Re: Fill a listbox

Unread post by daveplummermd » 8 Mar 2018 15:35

Hey, listen. Thank you for your help on the list box and guidance for overall learning. I must say, that I thought I was the only one in the Midwest on the steep learning curve. I feel very confident in VIP 5.x, but am struggling here in Minnesota trying to find all the functions and predicates that are available.

So, thanks again.
Dave Plummer

User avatar
Thomas Linder Puls
VIP Member
Posts: 2414
Joined: 28 Feb 2000 0:01

Re: Fill a listbox

Unread post by Thomas Linder Puls » 8 Mar 2018 17:15

Whenever we employ a new Prolog programmer here at PDC we take them through those Tutorials that are in the first section (i.e. above Books).

Such people have masters degree in computer science, but very often no or very little knowledge about Prolog and Visual Prolog.

People that have knoweldge about Vip5 often think they have sufficient knowledge to jump straight into it. But it is my experience they end spending more time than if start from scratch. Obvioulsy people with knowledge about Vip 5 will find some of the things in the tutorials easy, but then they just spend less time on that. On the other hand, starting from scratch can make you aquainted with the IDE/language/library step-by-step, which for most people result in a less steep learning curve, and much faster progress.

When it comes to "find stuff", I can suggest creating a (console) project that contains all pfc packages. If you add the attached files to the project everytning will be added automatically. Once things has been added you can remove them again. Those files corresponds to the Commercial Edition, if you have the Personal Edition you will receive a lot of error, but I believe relevant things will be added anyway.

Such a project contains every thing that is available and therefore you can use it for browsing for things. You can also experiment with small things in the "main.pro" file, before inserting them in your real project.

Given that it is a console project you cannot (obviously) experiment with GUI stuff, but you can still browse for GUI entities.

Once the project is compiled you can for example choose Go to -> Source Browser Ctrl+B and type "clientrect" in the search box to find things that contains those characters.
Attachments
vip_ce.pack
(4.81 KiB) Downloaded 128 times
pfc_ce.pack
(45.55 KiB) Downloaded 126 times
Regards Thomas Linder Puls
PDC

daveplummermd
VIP Member
Posts: 88
Joined: 18 Jul 2006 17:18

Re: Fill a listbox

Unread post by daveplummermd » 8 Mar 2018 21:30

Thank you Thomas. I will re-direct my approach to learning.
Appreciate the feedback and guidance.

dave plummer
Dave Plummer

Post Reply