Documentation problem.

The following is a rant. It is indicative of an ongoing problem with XOJO.
Poor and often incorrect documentation.

Using 2019 r3 the following is from the 2019r2 documentation so I assume it is up to date as:
Claim made: This page was last edited on 12 November 2019, at 18:58.

Create a new Xojo desktop application.
Copy sample code from: Page Not Found — Xojo documentation into an APP event handler open().

Var dbFile As FolderItem
dbFile = Folderitem.OpenFileDialog("")

If dbFile <> Nil Then
Var db As New SQLiteDatabase
db.DatabaseFile = dbFile
Try
db.Connect
MessageBox("Connected to " + dbFile.Name)
Catch error As DatabaseExeception
MessageBox("Error: " + error.Message)
End Try
End If

Press RUN icon. I get three errors.

  1. Folderitem.OpenFileDialog("") does not exist
  2. DatabaseExeception is not a recognized type
  3. messageBox error which is just from 2. not existing

Point #2:
What do I do when i do not have internet access? There are many places I travel to that do not have internet, phone, or cell phone access. What i wouldn’t give for a complete set of language documentation in a .pdf file!

Here endeth the rant.

[quote=469226:@Jesse Davis]Point #2:
What do I do when i do not have internet access? There are many places I travel to that do not have internet, phone, or cell phone access. What i wouldn’t give for a complete set of language documentation in a .pdf file![/quote]
Look in preferences, there is a Local option for the Language Reference. I prefer it to the internet version.

I don’t have time to look at issue #1 at the moment.

@Jesse Davis

#1. The sample code writes “DatabaseExeception” which is incorrect. It should be “DatabaseException”. Also, replace “FolderItem.OpenFileDialog” with “GetOpenFolderItem”. I agree that this example is a mess.

#2. Go to Xojo preferences. Under General/When seeking help, select Use built-in documentation.

This is the correct code:

[code]Var dbFile As FolderItem
dbFile = Folderitem.ShowOpenFileDialog("")

If dbFile <> Nil Then
Var db As New SQLiteDatabase
db.DatabaseFile = dbFile
Try
db.Connect
MessageBox("Connected to " + dbFile.Name )
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try
End If[/code]

And here is somewhat less terrible code:

[code]dim dbFile As Folderitem = Folderitem.ShowOpenFileDialog("")
If dbFile = Nil Then Return

dim db As New SQLiteDatabase
db.DatabaseFile = dbFile
Try
db.Connect
MessageBox("Connected to " + dbFile.Name)
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try[/code]

Var dbFile As FolderItem
dbFile = Folderitem.OpenFileDialog("") //  <<< ShowOpenFileDialog

If dbFile <> Nil Then
  Var db As New SQLiteDatabase
  db.DatabaseFile = dbFile
  Try
    db.Connect
    MessageBox("Connected to " + dbFile.Name )
  Catch error As DatabaseExeception //  <<< Typo ! DatabaseException
    MessageBox("Error: " + error.Message)
  End Try
End If

<https://xojo.com/issue/58706>

Thanks for the pointers. Note, however, that OpenFileDialog should work, according to the documentation:

New in 2019r2
Creates a customizable Open-file dialog box. The non-customizable version of this dialog is displayed by the FolderItem.ShowOpenFileDialog function.

I am sorry that I did not catch the spelling error (pasted from the sample). A spell checker would be handy in the editor. I am a terrible speller!

Thanks also for the guidance on the local documentation; however, many entries attempt to open an online page.

Best Regards and Season’s Greetings!

jd

I think you’re misreading the docs
OpenFileDialog still exists but is quite different than Folderitem.ShowOpenFileDialog and would require very different code more like

Var dbFile As FolderItem
Dim dlg As New OpenFileDialog
// set the properties of the dialog here for title etc etc etc
dbFile = dlg.ShowModal

this gives you the customizable dialog

the old call for using a non-customizable one is more like

Var dbFile As FolderItem

dbFile = GetOpenFolderItem

Its misspelled in the example itself
Autocomplete kind of acts like a spell checker
But it cant alway be right because its not unusual to write code before writing all the supporting methods
How would it know the difference between “misspelled” and “doesnt exist yet” ?
Thats what the compiler eventually catches

Thank you for creating a case, Norman. I’ve fixed this issue in the online reference which means it will be fixed for the 2020r1 local language reference.

@Geoff Perlman — OK but to improve the whole system, I think that code samples should always come from a sample project which follows evolutions of the Xojo language!

I don’t think that fixing individual code samples would lead us anywhere !

But this is a start since everyone assume these sample code works.

Oh, and this is not a simple job.

Emile Schwarz : Yes everyone assumes. The ONE thing that must be 100% good all the time is example code.

Stphane Mons: Any project manager will tell you that random stabs at fixing anything is counter productive. The idea of using a sample project from which to draw sample code snippets is a start. Really what is needed is a coherent approach to the ENTIRE documentation problem. XOJO has taken the approach that NO PLAN is better than funding an organization. Try looking at the latest documentation page (how one knows it’s the latest is a mystery to me!). Select, say, tutorials then Sqlite. One gets a long article with a careful explanation of databases and sqlite. It’s very nice except that one of the main ideas, that of the DATA CONTROL, apparently does not exist. It’s still in the widget library but it’s not functional.

Many years ago as a newly minted engineer I was told that “no documentation is better that incorrect documentation”. I would truly hate to be responsible for someone’s death or injury from applying erroneous information taken from documentation I created. Before you say “it’s only software what can it hurt?” think of Boeing Aircraft and the MAX 737.

Regards,
jd

<https://xojo.com/issue/58286> …

I don’t know why I bother…

[quote=469267:@]<https://xojo.com/issue/58286> …

I don’t know why I bother…[/quote]
My guess is that case was not properly changed to Category: Documentation >> Language Reference, so it was never “fixed”.

Or maybe not, I see <https://xojo.com/issue/58672> was changed to Category: Documentation but still not fixed.