Recent

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Beginners / Re: Find child controls by name
« Last post by Josh on Today at 12:02:31 am »
search for
findcontrol or findcomponent

containers have these

ie

form1.findcomponent

panel1.findcomponent

non tested code, to show idea

Code: Pascal  [Select][+][-]
  1. var c:tcontrol;
  2. ...
  3.  
  4. begin
  5.   c:=mypanel.findcontrol('mycontrol');
  6.   if c is mycontroltype then  
  7.   begin
  8.     with c as mycontroltype do  
  9.     begin
  10.        ...
  11.     end;
  12.   end;
  13. end;
  14.  
12
General / Re: location of non visual component
« Last post by VisualLab on April 17, 2024, 11:58:55 pm »
Thanks for the information.
@wp, why not put top/left in the object inspector? This could be useful in such situation.

TImageList comes from the TComponent class, which does not have the "Left" and "Top" properties. These properties appear in the TControl class. It appears that the positioning (i.e. "Left" and "Top" "properties") of non-visual objects (i.e. those located in the inheritance tree outside the TControl class) at the design stage is managed by the Lazarus GUI editor (forms and data modules).
13
I often use the for loop index for naming ne controls and case statements.
14
Beginners / Find child controls by name
« Last post by Joanna on April 17, 2024, 11:51:37 pm »
Hi everyone, I just wrote some clunky code for a twincontrol helper but in retrospect is there a better way to determine if a twincontrol already contains a child control with a particular name?
 I’ve seen the method containsthiscontrol() but that doesn’t work for the name. As you all probably know, duplicate names cause a crash. If I remember correctly, more than one unnamed control will also be interpreted as duplicate names.
here is what i did
Code: Pascal  [Select][+][-]
  1. FUNCTION TWINCONTROL_HELPER.CONTAINS_NAME( CONST ANAME: STRING) : BOOLEAN;
  2.            VAR X:INTEGER;
  3.  BEGIN
  4.  FOR X:= 0 TO {SELF.}ControlCount -1 DO
  5.      IF UPCASE(Controls[X].NAME) = UpCase(ANAME)
  6.         THEN EXIT(TRUE);
  7.  RESULT:= FALSE;
  8.  END;
Another strange thing is I couldn't get the controlcount to appear in the helper autocomplete list without typing self first. i have often noticed that the auto complete behavior inside helpers doesn't seem to work as well as other places..
15
Editor / Re: Lazarus editor feature request
« Last post by 440bx on April 17, 2024, 11:49:08 pm »
It seems to me that this would be a useful functionality.
Thank you for expressing your view on the feature.  I suppose the greater the number of people who like it, the better its chances are to be implemented.
16
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by TRon on April 17, 2024, 11:46:47 pm »
how can I implement WriteFile ?
Free Pascal comes with packages/units. Interesting reads there, including an answer to that question.

Quote
the file will be created, but the text "buffer" is not included.
Why ?
More interesting would be to know why your code did not crash (hint: it should have).
17
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by 440bx on April 17, 2024, 11:45:59 pm »
As @rvk pointed out above, there are several problems with your function definition. 

Try this one:
Code: Pascal  [Select][+][-]
  1. type
  2.   { _OVERLAPPED                                                               }
  3.  
  4.   PPOVERLAPPED = ^POVERLAPPED;
  5.   POVERLAPPED  = ^TOVERLAPPED;                        { kernel32 name         }
  6.   TOVERLAPPED  = record
  7.     Internal      : ptruint;
  8.     InternalHigh  : ptruint;
  9.  
  10.     Union         : record
  11.       case integer of
  12.         1 : (
  13.              Offset     : DWORD;
  14.              OffsetHigh : DWORD;
  15.             );
  16.  
  17.         2 : (
  18.              ptr        : pointer;                   { renamed from "pointer" }
  19.             );
  20.     end;
  21.  
  22.     hEvent        : THANDLE;
  23.   end;
  24.  
  25.   PDWORD = ^DWORD;
  26.  
  27. function WriteFile
  28.            (
  29.             { _in_              } InFile                  : THANDLE;
  30.             { _in_        const } InBuffer                : pointer;
  31.             { _in_              } InNumberOfBytesToWrite  : DWORD;
  32.             { _out_             } OutNumberOfBytesWritten : PDWORD;
  33.             { _inout_opt_       } InoutoptOverlapped      : POVERLAPPED
  34.            )
  35.          : BOOL; stdcall; external kernel32;
18
General / Re: location of non visual component
« Last post by Paolo on April 17, 2024, 11:37:22 pm »
Thanks for the information.
@wp, why not put top/left in the object inspector? This could be useful in such situation.
19
Editor / Re: Lazarus editor feature request
« Last post by VisualLab on April 17, 2024, 11:35:56 pm »
Lets see, if others have opinions on how this would work for them...
Yes, it would be nice to have other opinions, whatever they may be.

It seems to me that this would be a useful functionality.
20
General / Re: Linux Workspaces -- StayOnTop?
« Last post by VisualLab on April 17, 2024, 11:25:09 pm »
Hi, I need an app to stay visible on all workspaces.

I have tried setting the Form with fsStayOnTop and fsSystemStayOnTop but it is not visible when I switch to another Workspace.

I know it is possible as the Linux App, "sticky" (yellow notes) does it. I just cannot figure out how to make it work with my code.

How do I do this?

Thanks

And it works in any windowed environment? Or maybe only in GNOME and KDE? I'm asking because Linux doesn't have a standard DE. Each of them works "in its own way".
Pages: 1 [2] 3 4 ... 10

TinyPortal © 2005-2018