Jump to content

Luciano França

uniGUI Subscriber
  • Posts

    280
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Luciano França

  1. I have several situations where I need to know which line the cursor is on in VCL I use Lin := Memo1.CaretPos.y;
  2. I need in "UniMemo" and "UniSyntaxEdit" Grateful.
  3. This code works in VCL and currently I'm porting this code to Unigui Once it's working I'll post a full demo for you
  4. I did it in a different way I created a form changer I'm still going to adapt it to Unigui but I believe it's simple see the code below Procedure P_ObjListaLayoutCtrl(FormSelf: TForm_HostBase; SalvarLer: String; ListObjetos: TStrings; DiminuirScala: Boolean = True; Modified: Boolean = False); Var I: Integer; Var aHeightScala, aWidthScala: Double; Var Linha, aNameComp, aNameForm, aPropComp, aValorComp: String; Var aComp: TControl; Var ctx: TRttiContext; Var Prop: TRttiProperty; Var varPropInfo: PPropInfo; Function F_AnchorsToString(Tipo: TAnchorKind): String; Begin Result := 'False'; if akLeft = Tipo Then Begin if akLeft in aComp.Anchors Then Result := 'True' Else Result := 'False'; End; if akTop = Tipo Then Begin if akTop in aComp.Anchors Then Result := 'True' Else Result := 'False'; End; if akRight = Tipo Then Begin if akRight in aComp.Anchors Then Result := 'True' Else Result := 'False'; End; if akBottom = Tipo Then Begin if akBottom in aComp.Anchors Then Result := 'True' Else Result := 'False'; End; End; begin // Button1:Width=150 Try if SalvarLer = 'L' then Begin if Trim(ListObjetos.Text) = EmptyStr then Exit; For I := 0 To ListObjetos.Count - 1 do Begin Linha := ListObjetos.Strings[I]; if (Pos('[', Linha) > 0) And (Pos(']', Linha) > 0) then Begin aNameForm := Copy(Linha, 2, Pos(']', Linha) - 2); Break; End; End; if aNameForm <> FormSelf.ClassName Then Begin ShowDialog(FormSelf, 'Esse Arquivo de DFM "' + aNameForm + '" Não corresponde a esse Form "' + FormSelf.ClassName + '"'); Exit; End; For I := 0 To ListObjetos.Count - 1 do Begin Linha := ListObjetos.Strings[I]; aNameComp := Copy(Linha, 1, Pos(':', Linha) - 1); aPropComp := Copy(Linha, Pos(':', Linha) + 1, (Pos('=', Linha)) - Pos(':', Linha) - 1); aValorComp := Copy(Linha, Pos('=', Linha) + 1, 999); if Trim(aNameComp) <> EmptyStr then Begin aComp := TControl(FormSelf.FindComponent(aNameComp)); if Not Assigned(aComp) Then continue; if Modified Then Begin aComp.Tag := -3377; continue; End; if aPropComp = 'Align' Then aComp.Align := TAlign(StrtointDef(aValorComp, 0)); if aPropComp = 'Parent' Then Begin if (aValorComp = FormSelf.Name) Or (aValorComp = F_ClassNameForm(FormSelf)) then aComp.Parent := FormSelf Else aComp.Parent := {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(FormSelf.FindComponent(aValorComp)); if Not Assigned(aComp.Parent) Then aComp.Parent := F_GetPanelParentNil(FormSelf); End; if aPropComp = 'Left' Then aComp.Left := StrToInt(aValorComp); if aPropComp = 'Top' Then aComp.Top := StrToInt(aValorComp); if aPropComp = 'Height' Then aComp.Height := StrToInt(aValorComp); if aPropComp = 'Width' Then aComp.Width := StrToInt(aValorComp); if aComp is {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF} Then Begin if aPropComp = 'TabOrder' Then {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(aComp).TabOrder := StrtointDef(aValorComp, 0); if (aPropComp = 'TabStop') And (Trim(aValorComp) <> EmptyStr) Then Begin if aValorComp = 'True' Then {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(aComp).TabStop := True Else {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(aComp).TabStop := False; End; End; if (aPropComp = 'akLeft') And (Trim(aValorComp) <> EmptyStr) Then Begin if aValorComp = 'True' Then aComp.Anchors := aComp.Anchors + [akLeft] Else aComp.Anchors := aComp.Anchors - [akLeft]; End; if (aPropComp = 'akTop') And (Trim(aValorComp) <> EmptyStr) Then Begin if aValorComp = 'True' Then aComp.Anchors := aComp.Anchors + [akTop] Else aComp.Anchors := aComp.Anchors - [akTop]; End; if (aPropComp = 'akRight') And (Trim(aValorComp) <> EmptyStr) Then Begin if aValorComp = 'True' Then aComp.Anchors := aComp.Anchors + [akRight] Else aComp.Anchors := aComp.Anchors - [akRight]; End; if (aPropComp = 'akBottom') And (Trim(aValorComp) <> EmptyStr) Then Begin if aValorComp = 'True' Then aComp.Anchors := aComp.Anchors + [akBottom] Else aComp.Anchors := aComp.Anchors - [akBottom]; End; if (aPropComp = 'Caption') And (Trim(aValorComp) <> EmptyStr) Then Begin if aComp is TButton then TButton(aComp).Caption := aValorComp; if aComp is TLabel then TLabel(aComp).Caption := aValorComp; End; if aPropComp = 'PageIndex' Then Begin if (aComp is TTabSheet) And (StrtointDef(aValorComp, -1) > -1) then if (TPageControl(TTabSheet(aComp).Parent).PageCount - 1) >= (StrtointDef(aValorComp, 0)) Then TTabSheet(aComp).PageIndex := StrtointDef(aValorComp, 0); End; End; End; End; if SalvarLer = 'S' then Begin if FormSelf is TForm_HostDae then Begin {$IFDEF VCL} aHeightScala := TForm_HostDae(FormSelf).LfResizerVcl.HeightScala; aWidthScala := TForm_HostDae(FormSelf).LfResizerVcl.WidthScala; {$ELSE} {$ENDIF} End Else Begin aHeightScala := 1; aWidthScala := 1; End; ListObjetos.Clear; ListObjetos.Add('[' + FormSelf.ClassName + ']'); For I := 0 To FormSelf.ComponentCount - 1 do Begin if (FormSelf.Components[I] is TControl) And (TControl(FormSelf.Components[I]).Tag = -3377) then Begin aComp := {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(FormSelf.Components[I]); if Not Assigned(aComp) Then continue; if Assigned(aComp.Parent) Then ListObjetos.Add(aComp.Name + ':Parent=' + aComp.Parent.Name) Else ListObjetos.Add(aComp.Name + ':Parent=Nil'); if Assigned(aComp.Parent) Then Begin Prop := ctx.GetType(aComp.ClassType).GetProperty('Caption'); if (Assigned(Prop)) and (Prop.Visibility in [mvPublic, mvPublished]) then ListObjetos.Add(aComp.Name + ':Caption=' + Prop.GetValue(aComp).Asstring); End; ListObjetos.Add(aComp.Name + ':Align=' + IntToStr(Integer(aComp.Align))); ListObjetos.Add(aComp.Name + ':Left=' + Floattostr(F_GetTamOriginal(aComp.Left, aWidthScala, DiminuirScala))); ListObjetos.Add(aComp.Name + ':Top=' + Floattostr(F_GetTamOriginal(aComp.Top, aHeightScala, DiminuirScala))); ListObjetos.Add(aComp.Name + ':Height=' + Floattostr(F_GetTamOriginal(aComp.Height, aHeightScala, DiminuirScala))); ListObjetos.Add(aComp.Name + ':Width=' + Floattostr(F_GetTamOriginal(aComp.Width, aWidthScala, DiminuirScala))); ListObjetos.Add(aComp.Name + ':akLeft=' + F_AnchorsToString(akLeft)); ListObjetos.Add(aComp.Name + ':akTop=' + F_AnchorsToString(akTop)); ListObjetos.Add(aComp.Name + ':akRight=' + F_AnchorsToString(akRight)); ListObjetos.Add(aComp.Name + ':akBottom=' + F_AnchorsToString(akBottom)); if aComp is {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF} Then Begin ListObjetos.Add(aComp.Name + ':TabOrder=' + IntToStr({$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(aComp).TabOrder)); if {$IFDEF VCL} TWinControl {$ELSE} TUniControl {$ENDIF}(aComp).TabStop Then ListObjetos.Add(aComp.Name + ':TabStop=True') Else ListObjetos.Add(aComp.Name + ':TabStop=False'); End; if aComp is TTabSheet Then ListObjetos.Add(aComp.Name + ':PageIndex=' + IntToStr(TTabSheet(aComp).PageIndex)); End; End; End; except on E: Exception do begin P_LogException(E); // Mudo end; end; End; Unit_LayoutControl.pas Unit_LayoutControl.dfm
  5. In this link http://forums.unigui.com/index.php?/topic/5410-cursor-position-in-tunimemo/#comment-98286 I was able to know the column that is the cursor but after a lot of searching and testing I didn't find anything that tells me how to know the line where the cursor is I tried the code below but it doesn't work. JSAddListener('blur', 'function(){ajaxRequest(this, "_blur", ["cpos="+this.codeEditor.cursorPosition().line])}');
  6. @Sherzod Can you help me with this issue I really need to solve this a lot to put my application to a client I have many hints and both source and cooldown time is very short. "Application.HintHidePause" does not work. Grateful.
  7. I believe I found a bug when I use the MainForm as "mfPage" and use the ScreenMask I can't block the MainMenu see the attached video. Bug MainMenu.mp4 ScreenMask MainMenu.7z
  8. @Sherzod Do you think there's a way to do this ? I here already exhausted my attempts to do this any idea ?
  9. It's not just Unigui apps that gives this problem I have pure VCL application that gives the same problem I've already had several clients where Microsoft's antivirus and Kaspersky detected it as a false positive This happens frequently to me.
  10. I didn't understand. However, I already gave you the path, now you must adapt this code to your needs. What you need to do is also possible with a dbgrid VCL that doesn't depend on JavaScript. From a Google search it should find better solutions using VCL that will be possible to use with unidbgrid
  11. If I have 4 items and all are selected = True When I try to move any of them they will all be moved I can only move one at a time if they are all selected = False But I would like to move one at a time even if everyone has selected = true See in the Unigui video that moving will move all items that are Selected = True already in video VCL only one item is moved even with all items Checked = True ListBoxUnigui.webm ListBox Desktop.webm
  12. I advise the colleague to change his approach It would be better to have a TClientDataset to be able to do a more elaborate search and link to a "TUniDbTreeGrid" and you could put some CSS to make it look like "TUniTreeMenu" I have it here and it works perfectly for Accounting Plan For my Main menu I did a simple search but as my system has few items there is no problem with the search I put the code for.
  13. procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = 13 then Begin UniDBGrid1.CurrCol := UniDBGrid1.CurrCol + 1; if UniDBGrid1.CurrCol = UniDBGrid1.Columns.Count then Begin UniDBGrid1.DataSource.DataSet.Next; UniDBGrid1.CurrCol := 0; End; End; end;
  14. I did exactly what the colleague needs, but for that I created a parent form and inherited all the forms from that other one, and that way everything that is done in that parent form is transmitted to the others
  15. With this example I can change the Items, but if it has "ShowCheckBoxes = True" and "SelectionMode = smSimple" all items that are True will be affected, is it possible to drag only one item ?
  16. Simple put your app in windows exclusion list, a quick google search https://answers.microsoft.com/pt-br/windows/forum/all/windows-10-adicionar-exceções-no-windows/71ebebbd-4e94-40fa-98d5-8308b4ad5a4f
  17. Solution type TUniPopupMenu = Class(uniMainMenu.TUniPopupMenu) Public ObjetoPai : TObject; End; procedure TForm_MenuPrincipal.UniDBGridCellContextClick(Column: TUniDBGridColumn; X, Y: Integer); begin PopupMenu_Grid.fObjetoPai := TUniDBGrid(Column.Grid); PopupMenu_Grid.Popup(X, Y, TUniDBGrid(Column.Grid)); end; ObjetoGrid := ((Sender as TUniMenuItem).GetParentMenu as TPopupMenu).fObjetoPai
  18. Hello, I need a solution to this issue.
  19. I can increase the font size of the Grid but the DbNavigator does not follow How could I increase font and icons size of DbNavigator
  20. function MainForm: TMainForm; begin Result := TMainForm(UniMainModule.GetFormInstance(TMainForm)); end; procedure TMainForm.UniDBTreeGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if key = 13 then // Does not work Showmessage('KeyDown'); { In my application, when the customer enters the Grid, I perform several actions, such as Opening the change of a Chart of Accounts register. } end; procedure TMainForm.UniDBTreeGrid1KeyPress(Sender: TObject; var Key: Char); begin if key = #13 then // Does not work Showmessage('KeyPress'); { In my application, when the customer enters the Grid, I perform several actions, such as Opening the change of a Chart of Accounts register. } end; initialization RegisterAppFormClass(TMainForm); end. Unigui OnKeyDown TreedbGrid.7z
  21. Version 1.90.0.1568 I just need to use the onkeydown event of the "UniDBTreeGrid" component in the "UniBDgrid" component I can use normally I tried to adapt a script you sent me about the same problem with Listbox but I couldn't http://forums.unigui.com/index.php?/topic/23515-key-13-doesnt-work-with-listbox -bug-unigui/#comment-133601
×
×
  • Create New...