Forum > PDAs and Smartphones

wince use componentcount adn componenst function

(1/2) > >>

burakb44:
hi,

I want to use the functions and components within the componentcount wince, but fails. error does not normally project. fails to arm-ce projects. may be due to causes?

ludob:
Can you attach a small program that shows the problem?

Here is a small app that works fine (drop a few checkboxes and a button on a form)

--- Code: ---procedure TForm2.Button1Click(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to ComponentCount-1 do
    if Components[i].ClassNameIs('TCheckBox') then
      TCheckBox(Components[i]).Checked:=not TCheckBox(Components[i]).Checked;
end;

--- End code ---
Clicking the button will invert the checks of all checkboxes.

burakb44:

--- Quote from: ludob on June 12, 2012, 01:16:02 pm ---Can you attach a small program that shows the problem?

Here is a small app that works fine (drop a few checkboxes and a button on a form)

--- Code: ---procedure TForm2.Button1Click(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to ComponentCount-1 do
    if Components[i].ClassNameIs('TCheckBox') then
      TCheckBox(Components[i]).Checked:=not TCheckBox(Components[i]).Checked;
end;

--- End code ---
Clicking the button will invert the checks of all checkboxes.

--- End quote ---

error does not normally project.
KolCe project also fails to

ludob:
Perhaps I wasn't clear enough. The sample code works fine on a Win CE 5.0 device.

Please show us the code that fails for you on wince.

burakb44:

--- Quote from: ludob on June 12, 2012, 03:03:01 pm ---Perhaps I wasn't clear enough. The sample code works fine on a Win CE 5.0 device.

Please show us the code that fails for you on wince.

--- End quote ---


I used code sent as an example. Lazarus 0.9.27 version of me could not be it?

 Lazarus-0.9.27-18800-fpc-2.2.3-20090223-win32

 Lazarus-0.9.27-18800-fpc-2.2.3-20090223-cross-arm-wince-win32

 2.80.3 kol-ce


my code

{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
{$ifdef FPC} {$mode delphi} {$endif}
unit RestOSClient;

interface

uses Windows, Messages, KOL {place your units here->}
{$IFDEF LAZIDE_MCK}, Forms, mirror, Classes, Controls, mckCtrls, mckObjs, Graphics;
{$ELSE} ; {$ENDIF}

type
  { TForm1 }
  {$I MCKfakeClasses.inc}
  {$IFDEF KOLCLASSES} TForm1 = class; PForm1 = TForm1; {$ELSE OBJECTS} PForm1 = ^TForm1; {$ENDIF CLASSES/OBJECTS}
  TForm1 = {$IFDEF KOLCLASSES}class{$ELSE}object{$ENDIF}({$IFDEF LAZIDE_MCK}TForm{$ELSE}TObj{$ENDIF})
    Button1: TKOLButton;
    CheckBox1: TKOLCheckBox;
    Form: PControl;
    KOLForm1: TKOLForm;
    KOLProject: TKOLProject;
    procedure Button1Click(Sender: PObj);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm1( var Result: PForm1; AParent: PControl );
{$ENDIF}

implementation

{$IFDEF KOL_MCK}
{$I restosclient_1.inc}
{$ENDIF}

{ TForm1 }

procedure TForm1.Button1Click(Sender: PObj);
var
  i:integer;
begin
  for i:=0 to ComponentCount-1 do
    if Components.ClassNameIs('TCheckBox') then
      TCheckBox(Components).Checked:=not TCheckBox(Components).Checked;
end;


initialization
{$IFNDEF KOL_MCK} {$I restosclient.lrs} {$ENDIF}

end.

Navigation

[0] Message Index

[#] Next page

Go to full version