Jump to content
Registration disabled at the moment Read more... ×

limelect

Members
  • Content Count

    930
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by limelect

  1. limelect

    Bitmap and TWICImage

    Out of curiosity, I have 2 functions, one OK, the other not 2 exact function, the PNG returns a white picture, the TIFF works procedure BITMAPtoPNG2(MyBitmap: TBitmap; destinationfilename: string); var MyWIC: TWICImage; // preserves transparency begin // Assert( MyBitmap.PixelFormat := pf32bit; << it was 24 same result MyWIC := TWICImage.Create; try MyBitmap.AlphaFormat := afDefined; MyWIC.LoadFromFile(FileSave); <<<<<<<<<<<<<<<<<<<<<<I have to do that // MyWIC.Assign(MyBitmap); <<<<<<<<<<<<<<<<<<<<<<< this return white picture MyWIC.ImageFormat :=TWICImageFormat.wifPng ;//wifPng; if Form1.TestIfFileExist(destinationfilename) then MyWIC.SaveToFile(destinationfilename); finally MyWIC.Free; end; end; THIS IS OK procedure BITMAPtoTIFF(MyBitmap: TBitmap; destinationfilename: string); var MyWIC: TWICImage; begin MyWIC := TWICImage.Create; try MyWIC.Assign(MyBitmap); <<<<<<<<<<<<< This is OK MyWIC.ImageFormat := TWICImageFormat.wifTiff; if Form1.TestIfFileExist(destinationfilename) then MyWIC.SaveToFile(destinationfilename); finally MyWIC.Free; end; end;
  2. limelect

    Bitmap and TWICImage

    Thanks, I thought so As you can see, I fixed it differently
  3. limelect

    Bitmap and TWICImage

    I fixed it by bringing b := TBitmap.Create; b.Assign(ImgView321.Bitmap); Send B to functions However, if I load b from a file, it does not work. (MyBitmap) I still wonder. Any explanation?
  4. limelect

    Libreoffice integration struggles

    Tried the above source, and those lines did nothing LoadWriterDocumentFromBytes(BytesOf(TXTData)); // LoadWriterDocumentFromBytes(BytesOf(HTMLData),'HTML Document (Writer)'); // missing something may be // LoadWriterDocumentFromBytes(BytesOf(RTFData),'Rich Text'); // also LoadWriterDocumentFromBytes(BytesOf(CSVData), 'Text - txt - csv (StarCalc)', CSVFilterOption); // for some reason 'csv' is not enough
  5. limelect

    Libreoffice integration struggles

    This worked for me a while ago (* // query the XComponentLoader interface from the desktop XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, desktop); // create empty array of PropertyValue structs, needed for loadComponentFromURL PropertyValue[] loadProps = new PropertyValue[0]; // load new calc file XComponent xSpreadsheetComponent = xComponentLoader.loadComponentFromURL( "private:factory/scalc", "_blank", 0, loadProps); // query its XSpreadsheetDocument interface, we want to use getSheets() XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument)UnoRuntime.queryInterface( XSpreadsheetDocument.class, xSpreadsheetComponent); // use getSheets to get spreadsheets container XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets(); //insert new sheet at position 0 and get it by name, then query its XSpreadsheet interface xSpreadsheets.insertNewByName("MySheet", (short)0); Object sheet = xSpreadsheets.getByName("MySheet"); XSpreadsheet xSpreadsheet = (XSpreadsheet)UnoRuntime.queryInterface( XSpreadsheet.class, sheet); // use XSpreadsheet interface to get the cell A1 at position 0,0 and enter 21 as value XCell xCell = xSpreadsheet.getCellByPosition(0, 0); xCell.setValue(21); // enter another value into the cell A2 at position 0,1 xCell = xSpreadsheet.getCellByPosition(0, 1); xCell.setValue(21); // sum up the two cells xCell = xSpreadsheet.getCellByPosition(0, 2); xCell.setFormula("=sum(A1:A2)"); // we want to access the cell property CellStyle, so query the cell's XPropertySet interface XPropertySet xCellProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xCell); // assign the cell style "Result" to our formula, which is available out of the box xCellProps.setPropertyValue("CellStyle", "Result"); // we want to make our new sheet the current sheet, so we need to ask the model // for the controller: first query the XModel interface from our spreadsheet component XModel xSpreadsheetModel = (XModel)UnoRuntime.queryInterface( XModel.class, xSpreadsheetComponent); // then get the current controller from the model XController xSpreadsheetController = xSpreadsheetModel.getCurrentController(); // get the XSpreadsheetView interface from the controller, we want to call its method // setActiveSheet XSpreadsheetView xSpreadsheetView = (XSpreadsheetView)UnoRuntime.queryInterface( XSpreadsheetView.class, xSpreadsheetController); // make our newly inserted sheet the active sheet using setActiveSheet xSpreadsheetView.setActiveSheet(xSpreadsheet); } catch( com.sun.star.lang.DisposedException e ) { //works from Patch 1 xRemoteContext = null; throw e; } *) unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; type TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} uses System.Win.ComObj; procedure TForm1.Button1Click(Sender: TObject); var xSpreadsheet,sheet,xCell,xSpreadsheets ,args,objDocument,objDesktop,Excel, Book: OleVariant; RowNumber: integer; ColNumber: integer; const xlCellTypeLastCell = $0000000B; // ExcelXP begin //excel := CreateOleObject('Excel.Application'); excel := CreateOleObject('com.sun.star.ServiceManager'); objDesktop:=excel.createInstance('com.sun.star.frame.Desktop'); args := VarArrayCreate([0,1], varVariant); // objDocument:=objDesktop.loadComponentFromURL('private:factory/swriter','_blank', 0, args) ; //load empty documemt // objDocument:=objDesktop.loadComponentFromURL('private:factory/swriter','G:\Delphi Projects\engineertips\Excel Row and Column Count\world_gps_map_database.xls', 0, args) ; objDocument:=objDesktop.loadComponentFromURL('private:factory/scalc','_blank', 0, args) ; //load new excel xSpreadsheets:= objDocument.getSheets; xSpreadsheets.insertNewByName('MySheet', 0); sheet := xSpreadsheets.getByName('MySheet'); // xSpreadsheet := (XSpreadsheets).queryInterface( XSpreadsheet.class, sheet); //xCell := xSpreadsheets.getCellByPosition(0, 0); xCell := sheet.getCellByPosition(0, 0); xCell.setValue(21); xCell := sheet.getCellByPosition(1, 0); xCell.setValue(521); // RowNumber := Sheet.UsedRange.EntireRow.Count; (* excel.Workbooks.Open( 'G:\Delphi Projects\engineertips\Excel Row and Column Count\world_gps_map_database.xls' ); // Sheet := excel.ActiveWorkbook.Worksheets[SheetName]; Book := Excel.Workbooks.Open('G:\Delphi Projects\engineertips\Excel Row and Column Count\world_gps_map_database.xls', False, // ConfirmConversions True ); // ReadOnly Sheet := Book.Worksheets[1]; //RowNumber := Sheet.UsedRange.EntireRow.Count; // May be wrong! //ColNumber := Sheet.UsedRange.EntireColumn.Count; // May be wrong! RowNumber := Sheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row; ColNumber := Sheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column; *) end; end.
  6. @Gabor64738 No, I think another way First, throw away all the files except the DPR fmx res and pas. Now load the DPR. Usually, this will be OK. If not, there is another option. Edit the DPR so All the paths will only be the file names. With that said, you have here are all the project files. And lastly, if this did not help, make a new project (name the new main to the old main) and also the project name to the old one. Change (copy) pas and fmx of the old main to the new one, then add all other pas files to the project. Doen.
  7. limelect

    D12 sdk and Android

    No SDK in the directory after installation of D12 C:\Users\Public\Documents\Embarcadero\Studio\23.0\CatalogRepository\AndroidSDK-2525-23.0.51961.7529 On my d10.2.3, there are a few exe files, including AVD Manager.exe C:\Users\Public\Documents\Embarcadero\Studio\19.0\CatalogRepository\AndroidSDK-2433_19.0.27659.1188 SDK base path I did choose Android during the installation Can I copy my d10 to my d12 ? or what On compiling, I get initialization of VM error D12 community edition P.S I have seen this
  8. limelect

    D12 sdk and Android

    @Dave NottageWell, you might be right, but as a professional using Pascal even before Delphi, I do not have the strength to use failing products. For Android, I will stick with Android Studio even though Delphi is better in that area and wait for a new version Maybe I will give it one more shot
  9. limelect

    D12 sdk and Android

    I will wait for Delphi 13, maybe it will be better
  10. limelect

    D12 sdk and Android

    The error saise Cannot locate sdk api level in this path..... I geuss it is not 32 bit
  11. limelect

    D12 sdk and Android

    yes on 32
  12. limelect

    D12 sdk and Android

    Yes, I started by checking the Java path, but on the 32 it does not allow me to change Furthermore, I tried to compile to 64, but it wants to update. I say ye,s it fails with no reason
  13. limelect

    D12 sdk and Android

    @Dave Nottage It is a mess; most directories are bad On Java 32-bit, it does not allow me to change it Maybe because I put both 32 and 64 as the same directory? The adb.exe does not exist and so on Up to today, I have bought all the Delphi. Should I buy now? Is this a Delphi joke
  14. limelect

    D12 java and Android

    Cannot deploy the application All Java should be in c:\bin, why? Ok, I put Java in bin Now it need c:\bin\ client\jvm.dll So I made this directory with jvm.dll I have jvm.dll in the server directory Lastly, I have this error during the initialization of VM Obviously, D12 did not initialize its Java during installation Any help?
  15. limelect

    D12 java and Android

    @Cristian Peța Sdk and Java it is not the same problem SDK is ok, but the link to Java is false Now the error is initialization of VM after putting Java at bin directory
  16. limelect

    Some open sourced tools for Delphi developers

    Nice answer, but they are given for you to use and advertise So be aware that the source in that case is not OPEN SOURCE.
  17. limelect

    Some open sourced tools for Delphi developers

    You are using some paid components. Is it advertising or free source?
  18. limelect

    Listview data problem

    I hope I explained my problem with the listview I have 2 pictures and 2 text Adding text ,the text items is OK, but Adding 2 pictures is the problem PListItemData = ^TListItemData; TListItemData = record theString: string; ThePicture: TBitmap; end; b: Tbitmap; <<<< is created at oncreat. var ClipItem: TListItem; ListItemData: PListItemData; while not FDQuery2.Eof do begin ------ process Query ClipItem := lvClip.Items.Insert(0); New(ListItemData); try ListItemData.theString := s.Text; <<< OK if ContainsText(s.Text, 'Picture') then begin b.Assign(nil); BlobField := FDQuery2.FieldByName('Image') as TBlobField; Stream := FDQuery2.CreateBlobStream(BlobField, bmRead);<<< read the picture b.LoadFromStream(Stream); ListItemData.ThePicture := TBitmap(b); <<<< get also the picture FreeAndNil(Stream); end; ClipItem.Data := ListItemData; except Dispose(ListItemData); end; FDQuery2.Next; end; No problem, no leak BUT !!!! Now to the problem of looping twice PListItemData(lvClip.Items[0].data).ThePicture <<<< first picture PListItemData(lvClip.Items[0].data).TheString <<< first text OK Second time in the loop PListItemData(lvClip.Items[1].data).ThePicture <<< got second picture PListItemData(lvClip.Items[1].data).TheString <<< second text OK But now PListItemData(lvClip.Items[0].data).ThePicture got the second picture SO, more explanation. The first item got the second picture!!! But the text is OK it has 2 texts no problem On the breakpoint, I see the watch list as PListItemData(lvClip.Items[0].data).ThePicture PListItemData(lvClip.Items[0].data).TheString PListItemData(lvClip.Items[1].data).ThePicture PListItemData(lvClip.Items[1].data).TheString
  19. limelect

    Listview data problem

    @Remy Lebeau To begin, thank you for helping a lot I cannot put here what I did, as it has too many places fixed. those 2 lines PListItemData(lvClip.Selected.Data).ThePicture.Free; Dispose(PListItemData(lvClip.Selected.Data)); were added in many places, and more my software closes nicely without any leaks So thanks again
  20. limelect

    Listview data problem

    Ok, I did a very simple test One line of text and delete then if ListItemData.ThePicture.empty then exit ;<<<<<<<<<<<< error cannot check ListItemData.ThePicture.Free; If I check with nil ListItemData.ThePicture is NOT nil I will keep checking to find what's going on.
  21. limelect

    Listview data problem

    Surely I followed your suggestion, which works OnDeletion is not done only if I want to delete Only if I delete a line in the list, unless I do not understand you This is why I have a form onclose. From the source New(ListItemData); try ListItemData.theString := s.Text; if ContainsText(s.Text, 'Picture') then begin ListItemData.ThePicture := nil; BlobField := FDQuery2.FieldByName('Image') as TBlobField; Stream := FDQuery2.CreateBlobStream(BlobField, bmRead); ListItemData.ThePicture := TBitmap.Create; ListItemData.ThePicture.LoadFromStream(Stream); FreeAndNil(Stream); end; ClipItem.Data := ListItemData; except ListItemData.ThePicture.Free; Dispose(ListItemData); end; lvClip.Items.EndUpdate; FDQuery2.Next; end; s.Free; That's it, nothing else Ok, let me explain the application. Sometimes you have text only, and at times text and Bitmap on the same line So I check for bitmap nill, but something fishy is that beside the above
  22. limelect

    Listview data problem

    @Remy Lebeau Obviously, it works, but using this, free gives an error D10,2,3 procedure TMyForm.lvClipDeletion(Sender: TObject; Item: TListItem); var ListItemData: PListItemData; begin ListItemData := PListItemData(Item.Data); if ListItemData <> nill then begin ListItemData.ThePicture.Free; <<<<<<<<<<<<<<<< error Dispose(ListItemData); end; end; On vcl.control procedure TWinControl.MainWndProc(var Message: TMessage); begin try try WindowProc(Message); finally FreeDeviceContexts; FreeMemoryContexts; end; except Application.HandleException(Self); <<<<<<<<<<<< error end; end; I wanted to add this to the program close procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); var i: Integer; ListItemData: PListItemData; begin for i := 0 to lvClip.Items.Count - 1 do // if lvClip.Items.Data <> nil then begin ListItemData := PListItemData(lvClip.Items.Data); if ListItemData <> nil then begin // PListItemData(lvClip.Items.Data).ThePicture.Free; ListItemData.ThePicture.Free; <<<<<<<<<< Error and // Dispose(ListItemData); <<<<<<<<<<< I cannot use this as it gives many more errors end; end; end; Any Idea ?
  23. limelect

    Listview data problem

    Thanks I will try it
  24. limelect

    ToolBar just knoledg

    I copied a toolbar from the Gexpert procedure list form Now, someone can explain The toolbar is on a NEW FORM. As one can see from the DFM, it has 2 sections object ToolBar: TToolBar Left = 0 Top = 27 Width = 552 Height = 22 AutoSize = True DisabledImages = dmSharedImages.DisabledImages <<<<<<< Images = dmSharedImages.Images<<<<<<<<<<<<< And the buttons show the icons On the form, there are no uses !!!! for it Can anyone explain why I see pictures on the buttons? Is it because GEXPERT is in my IDE? This means I can use all Delphi resources, even if they are hidden. P.S. Running this form, the icons disappear !!!
  25. limelect

    ToolBar just knoledg

    @Uwe Raabe I thought so as long as the Gexpert DLL is installed. @Lajos Juhász Is wrong. I suggest you try it, it's so simple to do. The toolbar pictures will not disappear
×