[Lazarus] K8055 counter [was: libusb access...]
Mark Morgan Lloyd rašė: Luca Olivetti wrote: ... This is now working fairly well and I'm starting to add extras- variable rate polling, counter rate extraction and so on. I'm left with one niggle though which has a fairly significant cosmetic effect. I've replaced the scrollbars in the original app with vertical TrackBars and ProgressBars for analogue output and input respectively. The ProgressBars work nicely with zero at the bottom, but the TrackBars appears to have zero immutably at the top. If I set debounce time to 0ms for I2 (with my app developed in Lazarus) then counter starts counting air (board is free from external connections)- it not stops even I shortening I2 input with Inp1 button. Can You test this with Your board? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Lazarus in KUbuntu 8.10
Hello, I trying install both fpc and lazarus svn versions in KUbuntu 8.10 i386. I follow instructions http://wiki.lazarus.freepascal.org/Installing_Lazarus#Installing_Free_Pascal_under_Linux.2FBSD_manually: as $THEPREFIX using /usr, $ETCDIR = /etc, but in 6 step on ppc386 -i I still geting 2.2.2 version. Where is my mistake? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Lazarus in KUbuntu 8.10
Vincent Snijders rašė: Valdas Jankūnas schreef: Hello, I trying install both fpc and lazarus svn versions in KUbuntu 8.10 i386. I follow instructions http://wiki.lazarus.freepascal.org/Installing_Lazarus#Installing_Free_Pascal_under_Linux.2FBSD_manually: as $THEPREFIX using /usr, $ETCDIR = /etc, but in 6 step on ppc386 -i I still geting 2.2.2 version. Where is my mistake? Can you check the symlink /usr/bin/ppc386? Does it point to the new compiler version? I followed instructions blindly, now I found where I did mistake: 2.2.2 need replace to 2.3.1. Now all is OK. Thanks for help -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Initializing my App
Dave Coventry rašė: Hi, How can I tell when my application has loaded and I can start initializing some of the form elements? At the moment I place all of the initialization routines in the FormCreate but quite often I get an 'external SIGSEHV' exception as the mouse generates a false onSelection event on a StringGrid, presumably because the StringGrid has yet to be fully loaded. If form is non modal then I do that in OnShow event, like this: // when form appears procedure TfrMain.FormShow(Sender: TObject); const SHOWED_FIRST_TIME: Boolean=False; begin if (not SHOWED_FIRST_TIME) then begin SHOWED_FIRST_TIME:=True; // initializing end; end; -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Strange Circular unit reference
Hello, When I want compile my app in Lazarus I get compilation error: Moduliai/irankiai.pas(9,64) Fatal: Circular unit reference between Irankiai and NustatymaiIO This is strange, because unit NustatymaiIO not uses unit Irankiai (only Irankiai uses NustatymaiIO in interface section). Any thoughts? FPC 2.2.2; Lazarus v0.9.27 r16883 i386-linux-gtk 2 (beta). -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] TSpeedButton an mouse capturing
Hello all, question is: should TSpeedButton capture the mouse (if mouse is clicked on button and if mouse is moved away from button then button still receives mouse movement events)? I asking because in TCustomSpeedButton.Create procedure to ControlStyle is added [csCaptureMouse], but I got OnMouseMove or OnMouseUp only if mouse is over speed button (Linux, i386, FPC 2.2.2, Lazarus svn v0.9.25 r16188M, Gtk1 (or Gtk2, on win not tested)). -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Prevent focus losing
Gabor Boros rašė: I tried your original problem now (earlier not) and TEdit don't loose focus. TCustomButton have a TabStop property. But TSpeedButton not because derived from TGraphicControl. Gabor This is workaround, thanks for suggestion. Another question: how is implemented focus grabbing in TCustomButton, is there way to disable focus grabbing in TSpeedButton? indeed.. maybe I doing something wrong :( Thanks! -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Prevent focus losing
Gabor Boros rašė: Hi, Why not use CustomEdit1.SetFocus in CustomSpeedButton1.Click? Gabor Hello, situation: I have TCustomEdit and TCustomSpeedButton; when focus is in edit and I press speed button then edit loses focus. How to prevent losing focus when I press speed button? This is workaround, thanks for suggestion. Another question: how is implemented focus grabbing in TCustomButton, is there way to disable focus grabbing in TSpeedButton? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Prevent focus losing
Hello, situation: I have TCustomEdit and TCustomSpeedButton; when focus is in edit and I press speed button then edit loses focus. How to prevent losing focus when I press speed button? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Lazarus IDE: bookmarks
Hello, i'm in trouble :D : how to unset or clear bookmarks shown in Lazarus IDE editor? Lazarus svn 15897; LCL_WIDGETSET=gtk2; pfc v2.2.0 -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ColotToRGB in GTK apps
Hello, I found solution: in unit GtkProc is procedure UpdateSysColorMap that updates SysColorMap array (from where ColorToRGB gets RGB values of system colors), but functionality of this procedure is disabled (NewSysColors is not defined). So i writed own procedure that based on code of mentioned procedure. Now this procedure I call in OnCreate and then ColorToRGB returns correct values. -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] ColotToRGB in GTK apps
Mattias Gaertner rašė: On Sat, 26 Jul 2008 21:55:03 +0300 Valdas Jankūnas [EMAIL PROTECTED] wrote: Hello, i trying get R G B values of system color clBackground (and others). So i use ColorToRGB function (app compiled with gtk2 widget set), but I get values that differs from actual color of form face. I found that these values match to values defined in unit GTKGlobals in array SysColorMap. Is this function not yet implemented or this is a bug? Lazarus svn 15819; fpc 2.2.0 i386; Linux i386 Kubuntu 8.04 These constants depend on widget class and user theme. For example a button has a different background than a form. And many themes use images or gradients or transparency and do not define a default color. I don't know what you are trying to achieve, but maybe you can use the functions of the lcl themes unit. My goal is button with duotone glyph: i load grayscale glyph from resources, then change glyph colors from clBackground (white in source glyph) to clWindowText (black in source glyph), and then transfer modified image in to button glyph. So, if I want calculate color transition then I must have RGB values of clBackground and clWindowText. In Windoze this works well, but in Linux one day I noticed that colors are not correct. I know only this way, but maybe is another (alpha channel?)? Thanks, I take look at themes.pas. -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Create transparency
Luiz Americo Pereira Camara rašė: I tried that sometime ago without success: http://thread.gmane.org/gmane.comp.ide.lazarus.general/22010 I studied Your code and found where problem is: DataDescription need initialize through variable. Working code (seems that TRGBA comes from GraphicEx.pas, but webpage with that source cose is timeouted so i use TRGBAQuad instead): uses IntfGraphics, LclType, GraphType; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); procedure DumpMem(Data: PCardinal; Size: Integer); var i: Integer; Color: TRGBAQuad; begin for i := 0 to Size - 1 do begin Color := TRGBAQuad(Data[i]); WriteLn('Red: ', Color.Red, ' Green: ', Color.Green, ' Blue: ',Color.Blue, ' Alpha: ', Color.Alpha); end; end; var ImgReader: TLazReaderBMP; IntfImg: TLazIntfImage; aprasas: TRawImageDescription; begin ImgReader := TLazReaderBMP.Create; IntfImg := TLazIntfImage.Create(0,0); //IntfImg.DataDescription.Init_BPP32_B8G8R8A8_M1_BIO_TTB(0, 0); aprasas.Init_BPP32_B8G8R8A8_BIO_TTB(0, 0); // there is IntfImg.DataDescription:=aprasas; // solution IntfImg.LoadFromFile('red.bmp', ImgReader); DumpMem(PCardinal(IntfImg.PixelData), IntfImg.DataDescription.Height * IntfImg.DataDescription.Width); ImgReader.Destroy; IntfImg.Destroy; end; -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Create transparency
Marc Weustink rašė: Valdas Jankūnas wrote: Marc Weustink rašė: A faster way, (which might work in most cases) is when you have a 24bit depth description with a 32bits per pixel image. How retrieve image description from TBitmap? IntfImage.DataDescription Then you can simply add an alpha description (precision=8, shift=24 or 0) to the rawimage. How i can do that? if Description.BitsPerPixel = 32 then begin if (Description.RedShift 0) and (Description.BlueShift 0) and (Description.GreenShift 0) then begin Description.AlphaPrec := 8; Description.AlphaShift := 0; end else if (Description.RedShift 24) and (Description.BlueShift 24) and (Description.GreenShift 24) then begin Description.AlphaPrec := 8; Description.AlphaShift := 24; end; end; Thanks -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Create transparency
Marc Weustink rašė: A faster way, (which might work in most cases) is when you have a 24bit depth description with a 32bits per pixel image. How retrieve image description from TBitmap? Then you can simply add an alpha description (precision=8, shift=24 or 0) to the rawimage. How i can do that? Another thing, I'm not sure if loading form IntfImage/RawImage sets the right pixelformat (and thus image description). Anyway, maybe the bmp is OK. How do you paint it ? I use Canvas.Draw method. I found another solution to not use a proxy image, but load resource from stream directly to LazIntfImage (created with Init_BPP32_B8G8R8A8_BIO_TTB description). Now i always got alpha channel and code is flexible to various image types (need just change image reader type). I thing il stay with this solution. Thanks for help -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Create transparency
Hello, My code loads a PNG image from resource, modifies it, and then paints on canvas: var png: TPortableNetworkGraphic; img: TLazIntfImage; bmp: TBitmap; begin // load from resource png:=TPortableNetworkGraphic.Create; png.LoadFromLazarusResource('a_png_image'); // prepare for modify img:=png.CreateIntfImage; png.Free; // modyfy .. changing colors, setting alpha, ... // prepare for draw bmp:=TBitmap.Create; bmp.LoadFromIntfImage(img); img.Free; // paint .. If image in resources has no alpha channel (img.HasTransparency returns False in these cases), then in resulting image i get black colour where i set colTransparent (in modyfy code block). How to insert alpha channel (or maybe mask, [transparency==mask in recent graphics changes?]) in existing image? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Anchoring with negative values
Mattias Gaertner rašė: If i place TImage (AutoSize=True) into Panel then which settings in OI i must change to let TPanel always accommodate TImage size? AutoSize=true How simple! :) Thanks -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Anchoring with negative values
Hello, on Form is placed Image, image at runtime can resize, image anchors to Form at horizontal center. I want make border around Image with Bevel, border must adapt change of size of Image. So i think: all sides of Bevel need anchor to corresponding sides of Image with BorderAround=-1, but i cant set Border size to negative values. As workaround i use Image.OnResize to adjust size and position of Bevel. Why Border size in BorderSpacing is restricted to only positive values? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Anchoring with negative values
Mattias Gaertner rašė: Why Border size in BorderSpacing is restricted to only positive values? To avoid overlapping. If you want an image with a border, why not put the TImage into a TPanel or TGroupBox? I always try avoid use of TWinControl where i can (because of additional handle [i heard this rule somewhere from old days]). If i place TImage (AutoSize=True) into Panel then which settings in OI i must change to let TPanel always accommodate TImage size? -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Read image from resources with TLazIntfImage
Marc Weustink rašė: Valdas Jankūnas wrote: Hello, how i can read PNG image from Lazarus resources using TLazIntfImage? I tried TPortableNetworkGraphic to read transparent PNG from resource or file, but in transparent areas of saved PNG image i get random garbage.Code: img:=TPortableNetworkGraphic.Create; img.LoadFromFile(FAILAS_OUT); img.SaveToFile(FAILAS_IN); img.Free; This code is correct? If so i report bug to bugtracker. When you only loading, the stream loaded from is internally stored, so when you only save this stream is saved. It should result in an exact copy of your source. However if you modify something, then it depends on the widgetset (since it gets converted to a bitmaphandle first). On Gtk1 or Gtk2 this will replace your 8bit alpha channel with a 1 bit channel. If i doing same test (with file) using TLazIntfImage with TFPCustomImageReader and TFPCustomImageWriter, then i get correct results, but i not know how using TLazIntfImage load image from resource. See TCustomBitmap loadfromlazarusresource code. I think somehow after the image is loaded, TPortableNetworkGraphic thinks something is changed and the original stream isn't saved. Thanks for info. -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Breakpoints
Hello, is it normal when breakpoint from previous project remains in new project? For example: in project i analysing LCL code and set breakpoint on call InitFPImageWriter(IntfImg, ImgWriter); in file lcl/include/custombitmap.inc; then i created new project, in that project open mentioned file and find that breakpoint still there. I using Lazarus svn 14975, Free Pascal Compiler version 2.2.0 [2007/08/31] for i386 -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Read PNG with transparency
Hello, how i can read PNG image with transparency from file or resource? Currently i using code: uses LazPng; var img: TPngImage; begin img:=TPngImage.Create; img.LoadFromFile('image.png'); ... But when i save loaded image i realized that transparency in saved image is gone, or if i check property img.Transparent i got False. I using Lazarus svn 14975, Free Pascal Compiler version 2.2.0 [2007/08/31] for i386 -- Valdas Jankūnas ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus