Jump to content

Recommended Posts

Posted
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>

Posted

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

  • 3 weeks later...
  • 1 year later...
  • 2 months later...
Posted

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

 

 

Posted

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
  • 5 months later...
Posted

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?

 

 

  • 4 weeks later...
  • 2 weeks later...
  • 2 years later...
Posted
On 7/21/2018 at 8:08 AM, Sherzod said:

Hello,

 

Which edition and build are you using?

The component works fine, but why the procedure DoSetRemoteValue(AIndex:Integer; Value: string) is not called when the component is included in a hidden panel (within a dbgrid)? this causes it to fail...

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...