Zazhir
Members-
Content Count
39 -
Joined
-
Last visited
Everything posted by Zazhir
-
In visual code, we have the option do press 'alt' and click in differents line, the IDLE will put a cursor n wich line selected. Whats the shortcut to this same action in Delphi Embarcadero? if theres a one....
-
I have a legacy application made and compiled with delphi XE6 (2014). This application since the beggining uses the **obsidian** theme color to style all the components presents in the Jvcl and Vcl. I want to change that. Current I have changed the theme color, but the only component that does not change whit it is the TRibbon component. In my ribbon component, there not a style theme that look like the TabletDark (the custom style that I'am using) I've searched a lot, but look like the only way to change the component style is to upload the Jvcl and Vcl. Here is my ribbon: Ribbon in the Tablet theme Custom Style Ribbon in the obsidian theme Is there a way to change the Ribbon style, to look like the theme that I'am using? or perhaps create another style for the component?
-
I did, but with not luck to get this working
-
Error on call esternal api Delphi XE6
Zazhir posted a topic in Algorithms, Data Structures and Class Design
I'm trying to make a request of type Get, for a simple API, which performs the query of unique codes of companies. I tried several ways to make this request, but all of them lead me to the following error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version or this one error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version I upgraded from Indy component to the lateste version, current 10.6.20 and am using Delphi XE6. Below is one of the functions I did, but that doesn't bring me anything in the request response, and gives me the erros bellow: function TfrmAttAreaExterno.searchData02; var URL, response: String; jsonStreamRetorno, jsonStreamEnvio: TStringStream; SSLIO: TIdSSLIOHandlerSocketOpenSSL; strm: TMemoryStream; Error: TStringList; begin memo01.Clear(); URL := 'https://www.receitaws.com.br/v1/cnpj/27865757000102'; strm := TMemoryStream.Create; try IdHTTP01.AllowCookies := True; IdHTTP01.HandleRedirects := True; IdHTTP01.ProxyParams.BasicAuthentication := False; IdHTTP01.ProxyParams.ProxyPort := 0; IdHTTP01.Request.Connection := 'Keep-Alive'; IdHTTP01.Request.ContentLength := -1; IdHTTP01.Request.ContentType := 'application/x-www-form-urlencoded'; IdHTTP01.Request.Accept := 'text/html, application/xhtml+xml, image/jxr, */*'; IdHTTP01.Request.AcceptEncoding := 'gzip, deflate'; IdHTTP01.Request.AcceptLanguage := 'pt-BR'; IdHTTP01.Request.BasicAuthentication := False; IdHTTP01.Request.Host := 'img.discogs.com'; IdHTTP01.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like ' + 'Gecko'; SSLIO := TIdSSLIOHandlerSocketOpenSSL.Create(IdHTTP01); SSLIO.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]; SSLIO.SSLOptions.Mode := sslmUnassigned; SSLIO.SSLOptions.VerifyMode := [sslvrfPeer, sslvrfFailIfNoPeerCert, sslvrfClientOnce]; SSLIO.SSLOptions.VerifyDepth := 0; try idHttp01.IOHandler:= SSLIO; response := idHttp01.Get(URL); memo01.Text := response; except on E: Exception do begin ShowMessage(E.Message); end; end; except on E: Exception do begin ShowMessage(E.Message); end; end; end; Please, any help would be appreciated! I just run of the ideas to what might be causing this issue. Plus, I just run over all the internet, and tried every single solution that looks like was going to help me.... -
unit compile with a different versio of idTCPConnection
Zazhir posted a topic in Algorithms, Data Structures and Class Design
I just update Indy's component to the latest version. I am using a thirdy party libary to make the request of an api call RESTResquest4Delphi. When I tried to run the projet, the follow erro occurs. Any idea on how to solve this issue? -
unit compile with a different versio of idTCPConnection
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
o I see, when I was upp to update the Indy, I follow the steps to delete these files, this was to avoid this kind of error? -
unit compile with a different versio of idTCPConnection
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
so I have to go back to the old version? that do not look right, keep in mind that i need the component in his recent version. -
unit compile with a different versio of idTCPConnection
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
if I just delete these old files, the erros is fixed? -
How to apply dark theme for Ribbon
Zazhir posted a topic in Algorithms, Data Structures and Class Design
I current have a Delphi application that was made and compiled in delphi XE6. The vcl and jvcl are installed on the IDLE. I just change the theme application for the Amakrits, a dark theme. But the Ribbon do not change to dark... looks like that the dark theme din't affect the ribbon. The butons inside a TRibbonGroup are in dark theme, bu not the ribbon and him componets it self. the only options available for the Ribbon styles are this three here, and none of then are actually a match for the dark theme that I' m using now. How can I apply the same theme style that my project is now using, to the ribbon component and all his sub elements? -
Error on call esternal api Delphi XE6
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
The thing is, the error occurs when i pass the method GET(). So I don't have anything to save, or not save, because a don't have a response coming from the request. -
How to apply dark theme for Ribbon
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
I believe that is Jcl - Jvcl component. So it is a third party component. -
I use Delphi XE6 in my aplications, all of the was made using this version. Recently i intall the same version on a new machine. All went good, the project's are compiling was expected. But when I go to close the Delphi compiler, I get this error of access violation on the module rtl.200.bpl. I tried to look for this module, but I could not found. Any ideia on how to solf this "error"?
-
Do not ask me how, but the error was fixed! - I just did a update on a component library inside Delphi's IDLE. The component was the Indy, but I think there not to do with the component it self but with the C:\Program Files (x86)\Embarcadero folder. Perhaps I just deleted some files that maybe was causing this issue. For those one that maybe want to attenpt to update Indy's component, here is the documentation on how to do that.
-
Error on call esternal api Delphi XE6
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
I don't want to download it, i just want the response of the request that i send to the api -
Bad unit format for IdSMTP.dcu
Zazhir posted a topic in Algorithms, Data Structures and Class Design
Hello! I am facing Bad unit format issue for Indy component. I was trying to update it, following the steps in this link: https://github.com/IndySockets/Indy/wiki/Updating-Indy. My version of Delphi is XE6, in this case I tried to compile the ```Indy150.groupproj``` file, but the project has not been compiled. It all started at that point. As I ended up giving up, I decided to go back to the old version of the Indy component. But when returning the files that had been removed and also adding them inside Delphi's IDLE the component paths: Indy 10 Core Design Team Indy 10 Protocols Design Time IP Abstraction Indy Implementation Design Time All of my projects that use the component cannot be compiled. All of them that use the SMTP library have stopped working. Which generates the error shown below: [dcc32 Fatal Error] UfrmSendEmail.pas(47): F2048 Bad unit format: 'IdSMTP.dcu' - Expected version: 27.0, Windows Unicode(x86) Found version: 27.0, Windows Unicode(x64) This unit sends emails using the SMTP server configuration. Do you know how I can resolve this error? -
Install package option don't show
Zazhir posted a topic in Algorithms, Data Structures and Class Design
I'am trying to install in Delphi XE6 the latest version of the Indy component: https://github.com/IndySockets/Indy/wiki/Updating-Indy I've follow the wiki update tutorial, using the Indy200.pgroup. I've build and compile, but when I search to the button os "install", i can not find then. https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Compiler_Versions I have seen that must be a option call "install" for install the indy component. -
Install package option don't show
Zazhir replied to Zazhir's topic in Algorithms, Data Structures and Class Design
thanks! I managed to install -
for me, happens with every time that I close the delphi application after a project was open...
-
Json file to Excel - with sub arrays
Zazhir posted a topic in Algorithms, Data Structures and Class Design
I've need to convert, using delphi, a huge *json file into Excel file. Tried to use this library, that is made specific to work with json's files, but as I'am pretty new on delphi development, my code doen'st work as espected... The json struct is just like this: [ { "cod_iof": 1, "cod_etd": null, "cod_tes": null, "owners": [ { "name_own": "MAX ALTER BEST", "cod_id": "1444471", "cod_rec": "4558522" }, { "name_own": "MESTER ALTER BEST", "cod_id": "1444471", "cod_rec": "4558522" } ], "address": [ { "cod_end": 4444444, "is_main": "Y" }, { "cod_end": 4444444, "is_main": "N" } ], "info": [ { "cod": 0 }, { "cod": 1 }, { "cod": 2 }, { "cod": 3 } ], "values": [ { "cod_est": 0, "cod_uyr": null } ], "builds": [ { "cod_tes": 1, "info": [ { "cod": 0 }, { "cod": 1 }, { "cod": 2 }, { "cod": 3 } ] } ], "fronts": [ { "cod_iuy": 1, "iuo_oo": 0 } ], "checks": [ { "cod_io": 1, "cod_oue": 1 } ] }, { //new list... } //.... ] This is not the real data, is just to show how my Json file, looks like. Is worth to say, that the real data, can pass more than 170.000k of lines. Is a pretty extense. The code that I' tried to adapt to my case, is this bellow: uses XSuperObject; procedure TfrmDadosPref.FormCreate(Sender: TObject); var F : TextFile; Arquivo,Buffer : String; i, x: integer; begin qryPesq.Open; //alteração para pesquisa - Sabino for i := 0 to qryPesq.Fields.Count - 1 do begin CmbConsulta.Items.Add( qryPesq.Fields[i].DisplayLabel); end; end; procedure TfrmMyForm.SpeedButton1Click(Sender: TObject); var JSONData: ISuperObject; DataArray, ProprietariosArray, EnderecosArray, CaracteristicasArray, ValorVenalArray, EdificadasArray, TestadasArray, CobrancasArray: TSuperArray; Proprietario, Endereco, Caracteristica, ValorVenal, Edificada, Testada, Cobranca: ISuperObject; I, J: Integer; Y: TSuperArray; begin // carregue seu arquivo JSON JSONData := TSuperObject.ParseFile('\path to data\data.json', False); // acesse a propriedade "data" do objeto JSON DataArray := JSONData.A['data']; for I := 0 to DataArray.Length - 1 do begin // acesse as sub-listas do objeto JSON ProprietariosArray := DataArray.O[I].A['owners']; EnderecosArray := DataArray.O[I].A['address']; CaracteristicasArray := DataArray.O[I].A['info']; ValorVenalArray := DataArray.O[I].A['values']; EdificadasArray := DataArray.O[I].A['builds']; TestadasArray := DataArray.O[I].A['fronts']; CobrancasArray := DataArray.O[I].A['checks']; for J := 0 to ProprietariosArray.Length - 1 do begin Proprietario := ProprietariosArray.O[J]; end; for J := 0 to EnderecosArray.Length - 1 do begin Endereco := EnderecosArray.O[J]; end; //... and then goes... end; //save the file next end; This is what I've made so far... but i belive there a better and easy way to do that. I just don't know how. I'am using Delphi XE6, I don't know if that can cause some divergency. -
Man, this kind what I was looking for!!! Supper useful! Thanks for the help. best regards, Zazhir
-
In VsCode, the shortcut is just like this https://stackoverflow.com/questions/72260699/cursor-on-multiple-lines-in-vs-code
-
but was exacly what i said at first 🤨
-
Not the same. For ex. I want to put a UpperCase method in the begging of every qryFieldbyName(...).asString... But theres diferrents qrys, so thats not going to "work" for this case
-
Shift+Click select the text until the place that i click, what I want is a shortcut to put a cursor in multiples lines, to edit than at same time
-
Destroy or clean TSaveDialog after save
Zazhir posted a topic in Algorithms, Data Structures and Class Design
I have a form that has some buttons to export a qry result to differents files formats. I'am using a TSaveDialog, that is located in the main Form [frmMainSIG]. The component works just fine, but when I click in more than one button that export to file, gives a access violation message. Tried to "clear" the component create at my main form [frmMainSIG]. I've tried the `Free` method and the `FreeAndNil`, but they don't destroy my component. The code of export to pdf ⬇ var Excel: variant; caminho, caminhoFicha, pastaFicha, edtCaminhoRelatorio: string; linha: integer; begin try if not frmMainSIG.frmSIG.dlgFileSave.Execute then exit; caminho := ExtractFilePath(frmMainSIG.frmSIG.dlgFileSave.Name) + ExtractFileName(frmMainSIG.frmSIG.dlgFileSave.FileName); edtCaminhoRelatorio := caminho; ShowMessage('Ficaremos inativos até a geração completas dos dados!'); pastaFicha := 'Imovel'; frmSig.jvAlertaProgress.MessageText := 'Iniciado!'; frmSig.jvAlertaProgress.Execute; frmExportarImovel.progressBarQry.Max := frmImovel.qryPesq.RecordCount; frmImovel.qryPesq.First; linha := 4; Excel := CreateOleObject('Excel.Application'); Excel.Visible := false; Excel.Workbooks.open(frmMainSIG.frmSIG.caminhoFicha + pastaFicha + '\modeloImovelSelecao.xlsx'); while not (frmImovel.qryPesq.Eof) do begin atualizaTela; Excel.WorkBooks[1].Sheets[1].Range['B'+inttostr(Linha+1),'J'+inttostr(Linha+1)].RowHeight := 35; Excel.ActiveSheet.Range['B'+inttostr(Linha+1)+':J'+inttostr(linha+1)].Borders.LineStyle := 1; Excel.WorkBooks[1].Sheets[1].Range['B'+inttostr(Linha+1),'J'+inttostr(Linha+1)].NumberFormat := '@'; Excel.ActiveSheet.Cells[Linha+1,2] := frmImovel.qryPesq.FieldByName('IMOV_ID_CODPREF').asString; Excel.ActiveSheet.Cells[Linha+1,3] := frmImovel.qryPesq.FieldByName('IMOV_TX_PROPRIETARIO').asString; Excel.ActiveSheet.Cells[Linha+1,4] := frmImovel.qryPesq.FieldByName('IMOV_TX_LOGRADOURO').asString; Excel.ActiveSheet.Cells[Linha+1,5] := frmImovel.qryPesq.FieldByName('IMOV_NR_NUMERO_PREDIAL').asString; Excel.ActiveSheet.Cells[Linha+1,6] := frmImovel.qryPesq.FieldByName('IMOV_TX_TIPO_IMOVEL').asString; Excel.ActiveSheet.Cells[Linha+1,7] := frmImovel.qryPesq.FieldByName('IMOV_NR_QUADRA').asString; Excel.ActiveSheet.Cells[Linha+1,8] := frmImovel.qryPesq.FieldByName('IMOV_NR_PISCINA').asString; Excel.ActiveSheet.Cells[Linha+1,9] := frmImovel.qryPesq.FieldByName('IMOV_NR_AREA_CONSTRUIDA_PREF').asString; Excel.ActiveSheet.Cells[Linha+1,10] := frmImovel.qryPesq.FieldByName('IMOV_NR_AREA_GERAL_COM_DESC_BEIRAL').asString; frmImovel.qryPesq.Next; linha := linha + 1; sleep(100); end; sleep(100); Excel.ActiveWorkbook.saveas(edtCaminhoRelatorio + ' RELATORIO_SIGATI' + '.xlsx'); sleep(1000); Excel.ActiveWorkbook.Worksheets[1].ExportAsFixedFormat(0, edtCaminhoRelatorio + ' RELATORIO.pdf',0,-1,0); Excel.Workbooks[1].Close; Excel.Quit; Excel := Unassigned; ShowMessage('Relatório gerado com Sucesso! 😊'); frmSig.jvAlertaProgress.MessageText := 'O Relatório foi Gerado com Sucesso!'; frmSig.jvAlertaProgress.Execute; progressBarQry.Position := 0; lblProgresso.Caption := '0 de 0'; lblProgresso.Refresh; if Application.MessageBox('Deseja abrir o arquivo?', 'Opção', MB_YESNO+MB_ICONINFORMATION) = mrYes then begin ShellExecute(0, 'open', PCHAR(frmMainSIG.frmSIG.dlgFileSave.FileName + ' RELATORIO.pdf'), nil, nil, SW_SHOWNORMAL); FreeAndNil(frmMainSIG.frmSIG.dlgFileSave); end; FreeAndNil(frmMainSIG.frmSIG.dlgFileSave); except on E: Exception do begin ShowMessage(E.Message); end; end; end; and the code to export to csv (excel file) var Excel: Variant; Linha, i : Integer; mostrar : boolean; caminho, edtCaminhoRelatorio, nome, extensao, saveDir: string; saveCSV: TSaveDialog; f: TextFile; begin if not frmImovel.qryPesq.IsEmpty then begin if Application.MessageBox('Deseja acompanhar o Excel carregando as informações?', 'Opção',MB_YESNO+MB_ICONINFORMATION) = mrYes then begin mostrar := true; showMessage('Não clique no Excel até que o procedimento termine, isso interrompe o carregamento.'); end else begin mostrar := false; showMessage('O Excel está oculto gerando as informações. Clique em "OK" para continuar. O sistema ficará desabilitado até que termine.'); end; frmSig.jvAlertaProgress.MessageText := 'Iniciado!'; frmSig.jvAlertaProgress.Execute; frmExportarImovel.progressBarQry.Max := frmImovel.qryPesq.RecordCount; frmImovel.qryPesq.First; Excel := CreateOleObject('Excel.Application'); Excel.Workbooks.Add; Excel.Visible := mostrar; Linha := 1; for i := 0 to frmImovel.qryPesq.FieldCount - 1 do Excel.WorkBooks[1].Sheets[1].Cells[Linha,i+1] := frmImovel.qryPesq.Fields[i].DisplayName; Linha := 2; while not frmImovel.qryPesq.Eof do begin for i := 0 to frmImovel.qryPesq.FieldCount - 1 do Excel.WorkBooks[1].Sheets[1].Cells[Linha,i+1] := frmImovel.qryPesq.Fields[i].Text; frmImovel.qryPesq.Next; Linha:=Linha+1; atualizaTela; end; Excel.Visible := false; sleep(100); // Salvar como CSV saveCSV:= TSaveDialog.Create(Self); saveCSV.Title:= 'Salvar como CSV'; saveCSV.Filter:= 'Arquivo CSV|*.csv'; saveCSV.DefaultExt:= 'csv'; saveCSV.FilterIndex:= 1; if saveCSV.Execute then begin AssignFile(f, saveCSV.FileName); end; Excel.ActiveWorkbook.saveas(saveCSV.FileName); Excel.Workbooks[1].Close; Excel.Quit; Excel := Unassigned; showMessage('Arquivo CSV salvo com sucesso!'); frmSig.jvAlertaProgress.MessageText := 'O Relatório foi Gerado com Sucesso!'; frmSig.jvAlertaProgress.Execute; progressBarQry.Position := 0; lblProgresso.Caption := '0 de 0'; lblProgresso.Refresh; if Application.MessageBox('Deseja abrir o arquivo?', 'Opção', MB_YESNO+MB_ICONINFORMATION) = mrYes then begin ShellExecute(Handle, 'open', PChar(saveCSV.FileName), nil, nil, SW_SHOWNORMAL); FreeAndNil(frmMainSIG.frmSIG.dlgFileSave); end; FreeAndNil(frmMainSIG.frmSIG.dlgFileSave); end else showMessage('Tabela não possui dados para serem exportados!'); end; After a click in this buttons, what I need to do is to destroy the frmMainSIG.frmSIG.dlgFileSave, to when I click in another button, the component are clean and ready to use! The line that "breaks" my code, only after a already generate the first file, is the if not frmImovel.qryPesq.IsEmpty then (first line). How can I do that, because the FreeAndNil method is not working for this case 😞