Jump to content

uniCombobox event on uniDbGrid


jeans_larghi

Recommended Posts

Hi, I want to know how to read the text in a uniedit or unicombobox during editing when used in a column in unidbgrid.
Using extEvent don't give me text  except for the event "data" useful for remote queries.
I need to manage and change edit text when data is no present in remote query, but ther is no possibility in dbgrid's unicombobox..... 
There are ways for manage events in controls embedded in grids?
 
jeans_larghi (Sesamo Software collaborator)
 

 

Link to comment
Share on other sites

Hi,

 

* Pressing additional chars..

 

A possible solution, try,
While it may help..

 

UniDBGrid1 -> ....

function reconfigure(sender, store, columns, oldStore, the, eOpts)
{
  //columns[2], 2 = your lookup column index
  columns[2].getEditor().on("keydown",
    function(obj, e){
      if(!columns[2].getEditor().store.findRecord("val", obj.getRawValue() + String.fromCharCode(e.keyCode)) &&
        e.keyCode!=8 &&
        e.keyCode!=35 &&
        e.keyCode!=36 &&
        e.keyCode!=37 &&
        e.keyCode!=38 &&
        e.keyCode!=39 &&
        e.keyCode!=40 &&
        e.keyCode!=46){
          e.preventDefault()
        }
      }
    );
 
  columns[2].getEditor().on("change",
    function(obj, e){
      if (obj.getRawValue() == "") {
        columns[2].getEditor().triggerEl.elements[0].dom.click();
        columns[2].getEditor().triggerEl.elements[0].dom.click()
      }
    }
  )
}

Best regards.

Link to comment
Share on other sites

delphi XE7 64 bit.  

unigui version 0.99.1195

procedure TscrQuadroE1.UniComboBox1RemoteQuery(const QueryString: string;
  Result: TStrings);
begin
   if (Trim(QueryString)='') and (Length(QueryString) > 49) then Exit;
 UniMainModule.QueryComuneGriglia.Active := false;
      UniMainModule.QueryComuneGriglia.Params[0].Text := UpperCase(QueryString)+'%';
      UniMainModule.QueryComuneGriglia.Active := true;
     UniMainModule.QueryComuneGriglia.First;
      while not UniMainModule.QueryComuneGriglia.Eof do
      begin
        Result.Add(UniMainModule.QueryComuneGrigliaCOM_COMUNE.AsString);
        UniMainModule.QueryComuneGriglia.Next;
      end;
      UniMainModule.QueryComuneGriglia.Active := False;

EXTEvent on unidbrid

function reconfigure(sender, store, columns, oldStore, the, eOpts)
{
  columns[6].getEditor().on("keydown",
    function(obj, e){
      if(!columns[6].getEditor().store.findRecord("val", obj.getRawValue() + String.fromCharCode(e.keyCode)) &&
        e.keyCode!=8 &&
        e.keyCode!=35 &&
        e.keyCode!=36 &&
        e.keyCode!=37 &&
        e.keyCode!=38 &&
        e.keyCode!=39 &&
        e.keyCode!=40 &&
        e.keyCode!=46){
          e.preventDefault()
        }
      }
    );
 
  columns[6].getEditor().on("change",
    function(obj, e){
      if (obj.getRawValue() == "") {
        columns[6].getEditor().triggerEl.elements[0].dom.click();
        columns[6].getEditor().triggerEl.elements[0].dom.click()
      }
    }
  )
 

}

Thanks for your help.

Link to comment
Share on other sites

  • 4 years later...
On 9/7/2015 at 5:53 PM, jeans_larghi said:

ok thanks.

If there is news on the topic please contact me.

FUNCTION  TUniHesabresi_Forms.GetIndexFromValueOfCombobox(UCombo: TUniComboBox; Value: string): Integer;
var
  I: Integer;
BEGIN
  Result := -1;
  FOR I := 0 TO UCombo.Items.Count - 1 DO
  BEGIN
    IF Trim(UCombo.Items[I]) = Trim(Value) THEN
    BEGIN          
      Result := I;
      Break;
    END;
  END;
END;


procedure TUniHesabresi_Forms.UQ_ExcelPropertiesBeforePost(DataSet: TDataSet);
begin
  UQ_ExcelPropertiesExcelSheetIndex.AsInteger := GetIndexFromValueOfCombobox(UCombo_ExcelSheetName, UQ_ExcelPropertiesExcelSheetName.AsString);
end;

 

Link to comment
Share on other sites

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