Listbox vs DesktopListbox

I have noticed that when I added a Listbox Control it is not A DesktopListbox Control in a Window.

The help sample is using DesktopListbox so when I follow the sample I got an error.

The Error
Listbox.HasHeading
DesktopListbox.HasHeader

How can make it a default that when i add a listbox control it is really a DesktopListbox and a deprecated Listbox

Most likely you are working on an older project file that started on a Xojo version that didn’t have DesktopXYZ controls.
You can try to convert your App to DesktopApp:
image

but you may find problems. Use backups for this.

1 Like

If you are going to convert please read the many posts about doing so. There are better ways than converting the entire Application in one go. Step by step is easier.

2 Likes

Make your window a DesktopWindow and not the old Window.

2 Likes

@Tim_Hare Now I understand… thank you!

Converting my small project breaks everything! :rofl:

Is this an observation or a cry for help? If the latter, we need details.

@TimStreater Just an observation!
It is a small application with odbcdatabase connection, recordset, listbox, contextual menu.
like…

SQLSelect became Select SQL
RecordSet became RowSet
rs.EOF became rs.AfterLastRow
rs.BOF became rs.BeforeFirstRow
rs.MoveNext → rs.MoveToNextRow
rs.MovePrevious → rs.MoveToPreviousRow
rs.Field → rs.Column
Listbox is DesktopListbox with properties change.

I just can’t imagine on my level of understanding XOJO (newbie). how can the developers of previous version handle this situation.

1 Like

Several haven’t updated to API 2.
Others only change what they need.
The rest decided to attack the conversion, started updating some parts, then others, and then the rest until they have full API 2 project.
I read that some, with small projects, created a new project and started transferring or coding the project almost as new.

1 Like

Here’s what I did:

I was helped at least to some extent in that I do all database access through wrapper methods, because I want to log any errors. Like this:

sub dbquery (Extends dbh as sqlitedatabase, sql at String, where as String, ParamArray args as Variant) as RowSet

// Called when we expect a RowSet to be returned. Returns the RowSet if rows are found without error.
// Returns Nil if no rows found. Also returns Nil if an error occurs, in which case a message is logged also.

Var reg As RowSet, errnum As Integer, errmsg As String

try
  reg = dbh.SelectSQL (sql, args)
  Return reg                                                            // Worked fine, just return
Catch e as DatabaseException
  app.dbErrorsCount = app.dbErrorsCount + 1
  errnum = e.ErrorNumber
  errmsg = e.Message
end try

dblogmsg (errnum, errmsg, where, sql, args)

Return Nil

End Sub

.
So I had to change at least these in only one place. Most of it is just a careful editing job.

1 Like

well noted @TimStreater. This info will be a great help for my XOJO development journey! Thanks a lot!