Jump to content

picyka

uniGUI Subscriber
  • Posts

    1087
  • Joined

  • Last visited

  • Days Won

    36

Everything posted by picyka

  1. picyka

    TUniTime

    Any suggestion?
  2. How would it look if you had a rule if campo.constain ('Active') verder else red
  3. picyka

    TUniTime

    https://www.loom.com/share/2875684026c941f0b48831558c5c1c9d Note with UniTimer turned on, field search does not work properly
  4. picyka

    TUniTime

    unit uniDBLookupComboBoxObject; interface uses System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms, Data.DB, uniGUIBaseClasses, uniGUIClasses, uniMultiItem, uniComboBox, uniDBComboBox, uniDBLookupComboBox, Aurelius.Bind.Dataset, System.Variants, devsul.model.search, Aurelius.Criteria.Linq, Aurelius.Criteria.Base; type TUniDBLookupComboBoxObject = class(TUniDBLookupComboBox) private { Private declarations } FRequired: Boolean; FListSource, FDataSet: TAureliusDataset; FCriteriaListSource: TCriteria; FListValues: TStringList; procedure ExecuteSearch; protected { Protected declarations } FOldUniTriggerEvent: TUniTriggerEvent; FSearch: TSearch; procedure DoSetRemoteValue(AIndex: Integer; Value: string); override; procedure MyTriggerEvent(Sender: TUniCustomComboBox; AButtonId: Integer); procedure LoadCompleted; override; procedure _RemoteQuery(const QueryString: string; Result: TStrings); procedure _GetKeyValue(const Value: string; var KeyValue: Variant); public { Public declarations } constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure SetSearch(Search: TSearch); published { Published declarations } property Required: Boolean read FRequired write FRequired default False; end; procedure Register; implementation uses view.search.default, uniGUIApplication, Winapi.Windows; procedure Register; begin RegisterComponents('UniGUI Extension', [TUniDBLookupComboBoxObject]); end; { TUniDBLookupComboBoxObject } constructor TUniDBLookupComboBoxObject.Create(AOwner: TComponent); begin inherited Create(AOwner); end; destructor TUniDBLookupComboBoxObject.Destroy; begin if Assigned(Self.FSearch) then Self.FSearch.Free; if Assigned(Self.FListValues) then Self.FListValues.Free; if Assigned(Self.FCriteriaListSource) then Self.FCriteriaListSource.Free; if Assigned(Self.FListSource)then Self.FListSource.Free; inherited Destroy; end; procedure TUniDBLookupComboBoxObject.DoSetRemoteValue(AIndex: Integer; Value: string); begin inherited; if (VarIsNull(Self.KeyValue)) and (Assigned(Self.FDataSet)) then Self.FDataSet.EntityFieldByName(String(Self.DataField)).AsObject := nil; end; procedure TUniDBLookupComboBoxObject.ExecuteSearch; begin with TuniFormSearch.Create(UniApplication) do begin try ConfigureSearch(Self.FSearch); ShowModal; if ModalResult = mrOk then begin if Assigned(Selected) then begin Self.FListSource.Close; Self.FListSource.SetSourceObject(Selected); Self.FListSource.Open; if Assigned(Self.FDataSet) then Self.FDataSet.EntityFieldByName(Trim(String(Self.DataField))).AsObject := Selected; if Assigned(Self.OnSelect) then Self.OnSelect(Self); end; end; finally Free; end; Self.SetFocus; end; end; procedure TUniDBLookupComboBoxObject.LoadCompleted; begin if Self.Required then Self.ClientEvents.UniEvents.Values['beforeInit'] := 'function beforeInit(sender, config){Ext.apply(sender,{allowBlank:false,msgTarget : ''side''});}'; if Self.Triggers.Count = 0 then begin with Self.Triggers.Add do begin IconCls := 'x-form-search-trigger'; HandleClicks := True; Visible := True; end; end else begin Self.Triggers[0].IconCls := 'x-form-search-trigger'; Self.Triggers[0].HandleClicks := True; Self.Triggers[0].Visible := True; end; Self.FOldUniTriggerEvent := Self.OnTriggerEvent; OnTriggerEvent := Self.MyTriggerEvent; if Self.RemoteQuery then begin FListValues := TStringList.Create; Self.OnRemoteQuery := Self._RemoteQuery; Self.OnGetKeyValue := Self._GetKeyValue; end; inherited; end; procedure TUniDBLookupComboBoxObject.MyTriggerEvent(Sender: TUniCustomComboBox; AButtonId: Integer); begin if AButtonId = 0 then Self.ExecuteSearch; if Assigned(Self.FOldUniTriggerEvent) then Self.FOldUniTriggerEvent(Sender, AButtonId); end; procedure TUniDBLookupComboBoxObject._GetKeyValue(const Value: string; var KeyValue: Variant); var lObj: TObject; lIndex : Integer; begin KeyValue := Null; lObj := nil; if not Value.IsEmpty and not Self.FListSource.IsEmpty then begin if FListValues.Count = 0 then lObj := Self.FListSource.InternalList.Item(0) else begin lIndex := FListValues.IndexOf(Value); if lIndex <> -1 then lObj := Self.FListSource.InternalList.Item(lIndex); end; if Assigned(lObj) then KeyValue := Integer(lObj); end; end; procedure TUniDBLookupComboBoxObject._RemoteQuery(const QueryString: string; Result: TStrings); var lListFields: TStringList; i: Integer; lCriterion: TLinqExpression; lCustomCriteria: TCriteria; lStrListValue: String; begin if (Self.FCriteriaListSource <> nil) and (Trim(Self.Text) <> Trim(QueryString)) then begin lListFields := nil; try lListFields := TStringList.Create; lListFields.Text := Self.ListField.Replace(';', sLineBreak); lCustomCriteria := Self.FCriteriaListSource.Clone; lCriterion := Linq[lListFields[0]].Upper.Like(UpperCase(VarToStr(QueryString)) + '%'); lListFields.Delete(0); for i := 0 to lListFields.Count - 1 do if Self.FListSource.FieldByName(lListFields).Tag = 0 then lCriterion := lCriterion or (Linq[lListFields].Upper.Like('%' + UpperCase(VarToStr(QueryString)) + '%')); lCustomCriteria.Where(lCriterion); Self.FListSource.Close; Self.FListSource.SetSourceCriteria(lCustomCriteria, 25); Self.FListSource.Open; lListFields.Text := Self.ListField.Replace(';', sLineBreak); Self.FListValues.Clear; while not Self.FListSource.Eof do begin lStrListValue := EmptyStr; for i := 0 to lListFields.Count - 1 do begin if i = 0 then begin if Self.FListSource.FieldByName(lListFields).AsString <> '' then lStrListValue := Self.FListSource.FieldByName(lListFields).AsString end else begin if Self.FListSource.FieldByName(lListFields).AsString <> '' then lStrListValue := lStrListValue + ' - ' + Self.FListSource.FieldByName(lListFields).AsString; end; end; if not lStrListValue.IsEmpty then begin Result.Add(lStrListValue); Self.FListValues.Add(lStrListValue); end; Self.FListSource.Next; end; finally lListFields.Free; lCriterion := nil; end; end; end; procedure TUniDBLookupComboBoxObject.SetSearch(Search: TSearch); var lObject: TObject; begin Self.FSearch := Search; Self.FListSource := TAureliusDataset(Self.ListSource.Dataset); Self.FDataSet := TAureliusDataset(Self.DataSource.Dataset); Self.FCriteriaListSource := Search.Criteria.Clone; lObject := Self.FDataSet.EntityFieldByName(String(Self.DataField)).AsObject; if Assigned(lObject) then begin Self.FListSource.Close; Self.FListSource.SetSourceObject(lObject); Self.FListSource.Open; Self.KeyValue := Integer(lObject); Self.UpdateText; end; end; end.
  5. picyka

    TUniTime

    The UniTimer only serves to update a label on the screen, showing the registration time of the registration, on this screen it has TUniDBLookupComboBoxObject components where internally it makes an automatic RemoteQuery, when the Unitimer is set with an Interval of 1000 the search on the component does not work correctly.
  6. picyka

    TUniTime

    I'm creating a stopwatch in a registration frame, on this screen I have a component of mine, TUniDBLookupComboBoxObject = class (TUniDBLookupComboBox) I put a TUniTime to update a label, but when it is active, the lookup component stops working correctly, I was unable to simulate, only in the system. Any suggestion ?
  7. If this is the behavior, they are right. But there are behaviors different from mobile pro desktop, for me this is at least strange.
  8. 1) http://prime.fmsoft.net/demo/touch/mdemo65.dll/server Access this address from your computer Note the number of active sessions 2) http://prime.fmsoft.net/demo/touch/mdemo65.dll/m Access this address by phone Go back to item 1, note that you increased the session, so far so good. Close the mobile browser, note the time it takes to master the number of active sessions.
  9. Version 1512 any improvements in this regard?
  10. Yes, the browser is closed and not placed in the background.
  11. Yes, closing the browser does not fire the event to perform session closure on the server!
  12. An interesting detail if I access the mobile system (/ m) through the computer works correctly, when closing the browser already dies the session, same problem only happens on mobile
  13. Just tested, the same thing happens, closes the browser on the phone but the session does not die. The test was performed on Android
  14. Closing the browser on the phone does not put it in the background.
  15. I'm not on my work computer, but it's simple to simulate, create a hybrid project by mobile phone (currently i use an iphone 7 in every browser the same thing happens) Access by phone http: // your ip:8077/m After access close browser Access from your pc http://localhost: 8077/server You will notice that the session only dies when the time is up, on the desktop we have the characteristic that when closing the browser already dies the session Version 1510
×
×
  • Create New...