Jump to content


Photo

TUniDBComboBox with ITEMS+VALUES

TUniDBComboBox ITEMS VALUES TUniComboBox

  • Please log in to reply
12 replies to this topic

#1 gerardocrisci

gerardocrisci

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 55 posts
  • LocationItaly

Posted 09 May 2016 - 06:24 AM

Hello everyone
 
finally I'm using this library to a project.
 
I ask you to have a component as TUniDBComboBox /TUniComboBox
that besides having the property Items
has properties by Values
to display a label
and set in the database a different value,
Thank you

 

<ul class="x-list-plain">

 <li value="C">Coffee</li>

  <li value="T">Tea</li>

  <li value="M">Milk</li>

  <li value="W">Water</li>

  <li value="J">Juice</li>

  <li value="B">Beer</li>

<ul>


  • 0

Italy.gif Italy is wonderful


#2 mika

mika

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 131 posts

Posted 09 May 2016 - 07:19 AM

This feature is very much needed here too. It's frustrating to create memory table just to get lookup values for simplest things.


  • 0

#3 gerardocrisci

gerardocrisci

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 55 posts
  • LocationItaly

Posted 10 May 2016 - 10:29 AM

I created a component
derived from UniDBComboBox
if anyone has any improvements ..

Attached Files


  • 2

Italy.gif Italy is wonderful


#4 mika

mika

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 131 posts

Posted 11 May 2016 - 06:08 AM

Seems to work great. Thank you gerardocrisci :)


  • 0

#5 gerardocrisci

gerardocrisci

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 55 posts
  • LocationItaly

Posted 11 May 2016 - 02:56 PM

:)


  • 0

Italy.gif Italy is wonderful


#6 gerardocrisci

gerardocrisci

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 55 posts
  • LocationItaly

Posted 31 May 2016 - 08:50 PM

Fixed some minor bugs

 

:cool:

Attached Files


  • 2

Italy.gif Italy is wonderful


#7 Heronim

Heronim

    Member

  • uniGUI Subscriber
  • PipPip
  • 32 posts

Posted 07 June 2016 - 08:29 PM

Very good!


  • 0

#8 Ronny Encarnacion

Ronny Encarnacion

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 531 posts

Posted 07 June 2016 - 08:55 PM

Do you have any guide how to implement the component in Unigui ?

 

 

Thanks 


  • 0

Ronny Encarnacion


#9 gerardocrisci

gerardocrisci

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 55 posts
  • LocationItaly

Posted 07 June 2016 - 09:36 PM

thanks :)  for appreciating my variation Combo component ..
If you find any error please let me know ...

  • 0

Italy.gif Italy is wonderful


#10 Servant5166

Servant5166

    Member

  • uniGUI Subscriber
  • PipPip
  • 30 posts

Posted 11 December 2017 - 12:23 AM

Do you have any guide how to implement the component in Unigui ?

 

 

Thanks 

I need this too. Please leave instructions on how to install


  • 0

#11 Daryl McMurray

Daryl McMurray

    Member

  • uniGUI Subscriber
  • PipPip
  • 29 posts
  • LocationOntario, Canada

Posted 12 February 2018 - 02:16 AM

I discovered a small flaw in the component from gerardocrisci...   if you change the item in the list but cancel the edit (call TDataset.Cancel), the component does not refresh and revert back to the previous value as stored in the table.  It will continue to show the new selected item from the list.
 
You can fix this by inserting:
 
  if DataLink.Editing = false then begin
    InternalText := value+'1';  // gives reason to send change back to browser.
  end;
 
before 
 
  Text := Value;
 
in the DataChange Method.    
 
I tried to attached a fixed version but the form won't let me...  - Thank you so much gerardocrisci for your original component and work.  :)

 

 


  • 0

#12 gerardocrisci

gerardocrisci

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 55 posts
  • LocationItaly

Posted 19 February 2018 - 10:31 AM

I did not think anyone was using my component and so I did not publish the changes.
you try this attached version

Attached Files


  • 1

Italy.gif Italy is wonderful


#13 Daryl McMurray

Daryl McMurray

    Member

  • uniGUI Subscriber
  • PipPip
  • 29 posts
  • LocationOntario, Canada

Posted 20 February 2018 - 12:35 AM

Thank you gerardocrisci - I just tried your updated component, but it still has the flaw I described in my post.  If you use your combobox to change the dataset value, but then cancel the change (dataset.cancel) instead of post, the component should switch back to showing the original value that it started with to match the dataset.  Yours does not do this.  It will continue to show the newly selected value even though it does not now match what is in the dataset. If you make the change I suggested, or some variation of it, it will reset to the correct value as it should. 

 

There is a similar flaw that occurs when the component is connected to an empty dataset, a record is inserted or appended, and then then canceled.  Like with the changed record, it keeps the new value instead of going blank like it should for an empty dataset.  

 

To fix that, add the following code AFTER the 

 

  Text := Value;
 
in the DataChange Method.    
 
  if datalink.Field <> nil then begin
    if datalink.Field.IsNull then begin
      InternalText := '1';
      text := '';
    end;
  end;
 

 

 

With those changes, I have made very good use of your component in several projects and I thank you again for your original work.

 

Cheers! :)


  • 1





Also tagged with one or more of these keywords: TUniDBComboBox, ITEMS VALUES, TUniComboBox

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users