Source language: Translate to:

problems with creating an movie database program

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

problems with creating an movie database program

Postby SebastianMader » Fri Apr 14, 2017 12:31 am

I have some movies on my harddisk and want to create a program that offers a list of these movies that can be searched or sorted by genre. If you klick on a film in the list, you should be directed to a page with movie-infos, cover artwork, rating and there should also be a link you can open and watch the movie-file. The list and informations to the films should be stored in a database.

I know there is the "dbpShowGrid", but this displays the database like a chart and it shold look like a list. Therefore I tried it with listbox. I´m not really a programmer and this is what I tried out:

Code: Select all
dbpOpenAccessDatabase "FilmDB" "movietitles.accdb" ""
dbpOpenTable "FilmDB" "Filminfos" ""

Loop "1" "[FilmDB.Filminfos.$RecCount]" "[X]"
 ListBoxAddItem "ListBox1" "[X]" "[FilmDB.Filminfos.Filmtitel] - [FilmDB.Filminfos.Genre]"
 dbpNext "FilmDB" "Filminfos"
EndLoop


But I did not get it further... I have not found a way to sort or search the list. Maybe I´m doing something wrong but as I said, I´m not a programmer... Is anybody of you willing to help me write such a programm? Unfortunately my try-out-period runs out of time in 2 or 3 days. But I did not want to buy Neobook as long as I am not sure that creating such a program is successful... I need such an program to put my movies in order.
SebastianMader
 
Posts: 4
Joined: Tue Mar 28, 2017 10:06 am

Re: problems with creating an movie database program

Postby Gaev » Fri Apr 14, 2017 5:10 am

SebastianMader:

there is the "dbpShowGrid", but this displays the database like a chart and it shold look like a list.

Take a look at the dbpSetColumnOrder command ... from the Help file ...
Purpose:
Specify the order in which columns/fields appear in the grid.

Category:
Grids

Syntax:
dbpSetColumnOrder "database id" "table" "field list"

database id
The name assigned to the database.

table
The name of the table.

field list
A list of the field names in the order you want them to appear in the grid. Each field name must be separated by a semicolon character (;). You can hide a field by omitting its name from the list.

Example:
dbpSetColumnOrder "AddrBook" "Contacts" "LastName;FirstName;Company;City;Street;State;Zip;Country;Telephone;EMail; WebSite;Comments"

... use this command to hide the fields that you do not wish to show in the grid.

therefore I tried it with listbox

A solution that uses a ListBox is possible ... but it is more complicated than one using the database/grid only.

there should also be a link you can open and watch the movie-file

Take a look at the dbpSetGridProperties command ... the OnDoubleClick property allows you to specify a subroutine where you can code actions to be taken whenever a row in the grid is double-clicked ... from the Help file ...
OnDoubleClick=subroutine
The name of a subroutine from your publication's Subroutine Action. The subroutine specified here will be executed whenever the user double clicks anywhere within the grid. You can use the dbpGetActiveField action in the subroutine to determine which field was clicked if needed. Subroutines are entered from the Actions page of NeoBook's Book Properties screen.

... in such a subroutine, you can extract the stored reference to the movie file ... you can then use the Run command to play it.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: problems with creating an movie database program

Postby SebastianMader » Fri Apr 14, 2017 1:54 pm

Thank you for your suggestions. I got the list of movies almost look like displayed in a listbox with "dbpSetGridProperties" and "dbpSetColumnWidths". But there are still a few problems for me to solve: How can I display for example the content of the column "actionofthemovie" on a separate page that is in the same row than the clicked filmtitle an the starting page. If I click on the film James Bond, for example, than I logically want the correspondung filminformation from the column "actionofthemovie" displayed. If James Bond is in column 1 (filmtitle), row 3, than of course row 3 from the "actionofthemovie"-column should be displayed.

With "dbpGetActiveField" I only get the name of the column, but not in which row I clicked the column (for example: I clicked to the third entry in the column "filmtitle" - row 3 - than the variable online says "filmtitle", but I have to know the exact field I clicked to display information exactly to the film I clicked on - on a separate page. Instead, I just used the variable ([FilmDB.Filminfos.Filmtitel])
SebastianMader
 
Posts: 4
Joined: Tue Mar 28, 2017 10:06 am

Re: problems with creating an movie database program

Postby Gaev » Fri Apr 14, 2017 2:35 pm

SebastianMader:

With "dbpGetActiveField" I only get the name of the column, but not in which row I clicked the column (for example: I clicked to the third entry in the column "filmtitle" - row 3 - than the variable online says "filmtitle", but I have to know the exact field I clicked to display information exactly to the film I clicked on - on a separate page.

For your needs, you don't need to know the actual column that the user double clicked.

However, when a user double clicks a row, that row becomes the "current record" .. meaning that the NeoBook special variable of the form [dbDatabaseName.dbTableName.dbFieldName] contains the value of the field (column) in the row that the user double clicked.

So, when you double click in row 3, the value of the cell at the intersection of Row 3 and Column headed FilmTitel can be found in [FilmDB.Filminfos.Filmtitel] ... you can verify this by placing an AlertBox command that shows the value of this special variable in the subroutine that responds to the double click n the grid.

This value keeps changing as you navigate up and down the rows ... so you can use SetVar to copy the needed value to another NeoBook variable.

Note that the little black triangle in the left most column of the grid (pointing towards the right) always tells the user which row is the "current row".

And I don´t really know how to resort the list alphabetically by genre or filmtitle with a button and how to search the list for titels I type in an input field.


To view records in a specific sort order, take a look at the commands dbpSort and dbpUnsort in the Help file.

For searches, take a look at dbpQuery

By the way, the Action Command Reference section of the Help contains all the available commands for this plugin ... you might want to read up on this list first ... will save you a lot of wait time on this forum.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: problems with creating an movie database program

Postby SebastianMader » Mon Apr 17, 2017 7:08 am

I finally got the program work like it should. But how to put the following feature into practice I have no idea about that: In a mediaplayer constructed with the DX-plugin I want the position of the movie to be controlled by Input textfield instead of a trackbar. How to do that?!?
SebastianMader
 
Posts: 4
Joined: Tue Mar 28, 2017 10:06 am

Re: problems with creating an movie database program

Postby Gaev » Mon Apr 17, 2017 11:16 am

SebastianMader:

In a mediaplayer constructed with the DX-plugin I want the position of the movie to be controlled by Input textfield instead of a trackbar. How to do that?!?

Read the Help file about the dxPlayFromTo command ...
Code: Select all
dxPlayFromTo "[Player1]" "0:0:8:00" "0:0:15:00" "HMS" "1"

... the Start Position and Stop Position parameters can also be specified in milliseconds.

You can also use dxSetPosition on a file that was previously loaded with dxOpenFile.

All of these commands require you to first create the player (and associate it with a rectangle object) using dxCreate
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 3 guests