GUI advice for one to many database relationship

What gui widgets do you folks normally use when
displaying an unknown number of records from a db?
(Ie. a sales order, and then its lines - where the
number of lines can vary from 1 to 50)

Do you generate text boxes dynamically? Or use a wxGrid?
Or something else?

Any advice would be appreciated.

TIA,
Bill

What gui widgets do you folks normally use when
displaying an unknown number of records from a db?
(Ie. a sales order, and then its lines - where the
number of lines can vary from 1 to 50)

Do you generate text boxes dynamically? Or use a wxGrid?
Or something else?

Any advice would be appreciated.

Depends on what you want to do with it. You can either use a wxGrid which will
allow you to handle field editing in a quite flexible way, or if you just
want to display the record and have a separate edit dialog you could use a
wxListCrtl in reportmode and call your edit dialog via a doubleclick or a
button. The later one is easier to code, although it may be less "user
friendly"

···

On Thursday 06 February 2003 02:53 pm, Bill W wrote:

TIA,
Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
  UC

--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417

Bill W wrote:

What gui widgets do you folks normally use when
displaying an unknown number of records from a db?
(Ie. a sales order, and then its lines - where the
number of lines can vary from 1 to 50)

Do you generate text boxes dynamically? Or use a wxGrid?
Or something else?

wxListCtrl works nicely.
Accepts any number of rows, is very fast, and you can pass the column names as column labels for generic browsing widgets. Doesn't work for editiig though, then you'll have to use wxGrid which is a bit slower and more complicated.

Horst

wxListCtrl works nicely.
Accepts any number of rows, is very fast, and you can pass the column
names as column labels for generic browsing widgets. Doesn't work for
editiig though, then you'll have to use wxGrid which is a bit
slower and
more complicated.

Funny, I had better luck with wxGrid than I did with wxListCtrl as far
as just getting it to work. wxGrid()'s interface just seemed to be a bit
easier to grasp.

I *will* have to get my head wrapped around wxListCtrl eventually,
though, since it happens to be more appropriate for what I was doing.

Robin:

Speaking of wxGrid, is there any way to get the 'cursor' to go away?

Jeff Grimmett wrote:

I *will* have to get my head wrapped around wxListCtrl eventually,
though, since it happens to be more appropriate for what I was doing.

An example to get you started, where "labels" is a list containing the column headers, and queryresult the rows fetched from the backend

#to create the columns:
for i in range(len(labels)):
         listctrl.InsertColumn(i, labels[i])

#display the query results
rowcount=0
for row in queryresult:
  self.InsertStringItem(rowcount,str(row[0]))
  #the first returned column contains the primary key:
  self.SetItemData (item, row[0])
  colcount=1
  for attr in row[1:]:
    self.SetStringItem(rowcount,colcount, str(attr))
                 colcount +=1
  rowcount +=1

#adjust column width according to the query results
for w in range(0, len(labels)):
  self.SetColumnWidth(w, wxLIST_AUTOSIZE)

Thanks for the replies.
I've got a wxGrid working quite nicely now.

Bill.

···

-----Original Message-----
From: Uwe C. Schroeder [mailto:uwe@oss4u.com]
Sent: Thursday, February 06, 2003 12:27 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] GUI advice for one to many database
relationship

On Thursday 06 February 2003 02:53 pm, Bill W wrote:

What gui widgets do you folks normally use when
displaying an unknown number of records from a db?
(Ie. a sales order, and then its lines - where the
number of lines can vary from 1 to 50)

Do you generate text boxes dynamically? Or use a wxGrid?
Or something else?

Any advice would be appreciated.

Depends on what you want to do with it. You can either use a wxGrid which
will
allow you to handle field editing in a quite flexible way, or if you just
want to display the record and have a separate edit dialog you could use a
wxListCrtl in reportmode and call your edit dialog via a doubleclick or a
button. The later one is easier to code, although it may be less "user
friendly"

TIA,
Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
  UC

--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Hi,

We're thinking of deploying an app that'd have a decent browser embedded in it - we need more compliance and Javascript support than what wxHtmlWindow provides.

I'm guessing that the wxMozilla component isn't accesible from wxPython?

Robb Shecter wrote:

Hi,

We're thinking of deploying an app that'd have a decent browser embedded in it - we need more compliance and Javascript support than what wxHtmlWindow provides.

I'm guessing that the wxMozilla component isn't accesible from wxPython?

Not yet, but it (or something like it) will be.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!