Jump to content
uniGUI Discussion Forums

Recommended Posts

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>

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.  :)

 

 

Share this post


Link to post
Share on other sites

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! :)

  • Upvote 2

Share this post


Link to post
Share on other sites

Hi  gerardocrisci

I am trying to use this component as an inplace editor in dbgrid. Do you know how can I force the grid to display Items instead of values? What I mean is, let's say the value in the dataset is 'CHAR' but I want to display 'Alphanumeric' for every row that has this value. Can you help me?

 

 

Share this post


Link to post
Share on other sites

  RegisterComponents('DINO UniGUI', [TxUniDBComboBox]); fail to properly register component.. do you have any idea why ? :o

Share this post


Link to post
Share on other sites

×