Search found 347 matches

by Harrison Pratt
1 Dec 2021 4:12
Forum: Visual Prolog
Topic: How to change background color of a standard Dialog without making custom control Dialog
Replies: 5
Views: 55

Re: How to change background color of a standard Dialog without making custom control Dialog

Are you using ViP 10?

I don't think changing dialog backgrounds in Vip 9 or earlier can be done easily.
by Harrison Pratt
26 Nov 2021 22:50
Forum: Visual Prolog
Topic: how to collect File Names in a specific Directory to a string List
Replies: 6
Views: 83

Re: how to collect File Names in a specific Directory to a string List

Try the code below in a console application. The predicate getFilesInDirectory_nd /3 returns the files in the directory nondeterministically, so you need to collect them for use somehow. For your purpose I assume you want to collect them all in a list, so you can use list comprehension to collect th...
by Harrison Pratt
26 Nov 2021 20:38
Forum: Visual Prolog
Topic: how to collect File Names in a specific Directory to a string List
Replies: 6
Views: 83

Re: how to collect File Names in a specific Directory to a string List

The directory class has a number of other useful predicates in addition to this one:

Code: Select all

directory::getFilesInDirectory_nd/3->   getFilesInDirectory_nd : (     string Directory,     string WildCard,     boolean IncludeSystem)     -> string FullFilename     nondeterm.
by Harrison Pratt
25 Nov 2021 19:40
Forum: Visual Prolog
Topic: ViP 10 IDE Variables
Replies: 0
Views: 67

ViP 10 IDE Variables

Trailing backslash required.png[/attachment]Vip 8x and 9x apparently are more forgiving about paths in IDE variables. When I don't suffix the path with a trailing '\' and perform Optimal Set of Include Directives on a folder to which the IDE variable points most of the various #include and #requires...
by Harrison Pratt
24 Nov 2021 13:49
Forum: Visual Prolog
Topic: Test mode does nothing
Replies: 1
Views: 77

Test mode does nothing

I installed ViP 10 PE (Build 1002) this morning and was greeted with this scrolling window to the VP web site. Is this what you intended to happen?

Also, the Test Mode option in the dialog editor does nothing.
by Harrison Pratt
8 Jul 2021 12:48
Forum: Visual Prolog
Topic: Unifying domains?
Replies: 4
Views: 1246

Re: Unifying domains?

If you want to avoid using or then this construct works.

Code: Select all

class predicates     findModelName2 : (mydomain M, string N [out]) determ. clauses     findModelName2(model, N) :-         modelFact(_, N),         !.     findModelName2(M, N) :-         modelFact(M, N),         !.
by Harrison Pratt
23 Jun 2021 11:59
Forum: Visual Prolog
Topic: Cannot use Windows Explorer to ZIP a VIP project using "Object Expressions"
Replies: 4
Views: 1267

Re: Cannot use Windows Explorer to ZIP a VIP project using "Object Expressions"

It seems that ZIP files are more restrictive than NTFS with respect to permissible filename characters:

https://stackoverflow.com/questions/205 ... a-zip-file
by Harrison Pratt
17 Jun 2021 21:29
Forum: Visual Prolog
Topic: Importing a list
Replies: 2
Views: 1023

Re: Importing a list

Here is a very simple way with no error checking or special processing. The code below assumes a file named WordsAcross.txt with the this sample text in it, Note the embedded carriage return between five and six: one,two,three,four,five, six,seven,eight,nine class predicates fileToList : (string Fil...
by Harrison Pratt
28 May 2021 15:11
Forum: Visual Prolog
Topic: Call dialog from predicate?
Replies: 2
Views: 1251

Re: Call dialog from predicate?

The 'continueDialog' project referenced in the Dialogs and Forms: Modeless dialogs example
( http://discuss.visual-prolog.com/viewtopic.php?t=8218 ) uses an older VP syntax and could pose some challenges to people new to VP. I have attached a tweaked version that compiles smoothly with Vip9x.
by Harrison Pratt
3 May 2021 11:30
Forum: Visual Prolog
Topic: Predicate declaration for using recursion on lists of objects with custom type
Replies: 3
Views: 1428

Re: Predicate declaration for using recursion on lists of objects with custom type

Look at your 3rd clause. H2 must be a string in the clause head, but in the last line it is a string_list. You need to create the output list you tried to represent as [H2|T2] within the clause.

Code: Select all

inw_str([H1|T1], [H2|T2]):-         inw_str(T1,T2),         inw_str(H1,H2).
by Harrison Pratt
5 Apr 2021 22:07
Forum: Visual Prolog
Topic: subset between sets
Replies: 2
Views: 1358

Re: subset between sets

Classical way, easy to understand: class predicates isSubSet : (T* CheckTerms, T* Terms) determ. clauses isSubset([H], Terms) :- list::isMember(H, Terms), !. isSubset([H | TT], Terms) :- list::isMember(H, Terms), isSubSet(TT, Terms). Another way using VIP list class predicates. Put your cursor on &q...
by Harrison Pratt
5 Apr 2021 10:29
Forum: Visual Prolog
Topic: How to check existence of an object
Replies: 5
Views: 1536

Re: How to check existence of an object

nothing(...) does nothing. It's a way of making the IDE capture an unused variable so you can see it when running the debugger. Unused variables do not consistently display in the Variables window when debugging without making them appear as being used to the compiler. It has no place in production...
by Harrison Pratt
4 Apr 2021 15:28
Forum: Visual Prolog
Topic: How to check existence of an object
Replies: 5
Views: 1536

Re: How to check existence of an object

One way would be to create a class database in your base class and store the object identifier information you need in that database when you create each object, something like that below. You will need to manage removing personObj/2 facts when objects are destroyed and you also should remember that...