Recent

Author Topic: DBCombobox  (Read 6586 times)

Zath

  • Sr. Member
  • ****
  • Posts: 391
DBCombobox
« on: September 09, 2015, 12:43:31 am »
Can someone guide me on the DBCombobox please.
I have an underlying SQL table and I'm making a "front end" for easy editing.
Values in fields are mostly numeric but are meaningless to a user.
The DBCombobox will be linked to an integer field where values denote a widget style.
I want the user to use the DBCombobox and select a user friendly word  from a list which then assigns the correct value into the field.
I've read sections that mention looping through many if statements and assigning values via code but I was wondering if there's a way that a value can be assigned from a string list.
ie
"Male Armour" , 10
"Female Armour" , 11
"Weapon" , 5
Selecting Female Armour in the dropdown list would apply 11 as a value into the field.

Thanks for any info.

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: DBCombobox
« Reply #1 on: September 09, 2015, 01:13:30 am »
You need TRxDBComboBox from RXLib for that. Set the items in Values property to match the list in the Items property.

RX Lib: https://svn.code.sf.net/p/lazarus-ccr/svn/components/rx/trunk/

(Open rxnew.lpk and install it)
« Last Edit: September 09, 2015, 01:18:27 am by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: DBCombobox
« Reply #2 on: September 09, 2015, 01:31:09 am »
Thanks for the reply.

Opening that link gives me a xml type view on screen and save target wants to give me a txt file.

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: DBCombobox
« Reply #3 on: September 09, 2015, 01:41:06 am »
When the URL starts with something like "https://svn", you are supposed to use a program like Tortoise to download it.

http://tortoisesvn.net/downloads.html

Its easy, install Tortoise, then make a directory called "rxnew" under lazarus components for example, then rightclick the dir and chose "check out". Now enter the link I gave you for RXLib and download it. After that you can install RX.

SVN (subversion) is how many of us get the latest versions of Lazarus and FPC, the development versions.
« Last Edit: September 09, 2015, 02:06:27 am by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: DBCombobox
« Reply #4 on: September 09, 2015, 09:49:13 am »
I missed the fact that it was an svn.
I already have tortoise installed so it should be ok.

 

TinyPortal © 2005-2018