-
for i:=0 to count do begin Self.ControlByName('v' + IntToStr(i)).Hint := 'AAAAA'; i := i +1 end;
Does not recognize ControByName Help me
thanks
-
Define: USE_NAMES Use: TObj.Name
> USE_NAMES - to use property Name with any TObj. > This makes also available method TObj.FindObj( name ): PObj.
-
Thanks for the quick response. Tonight I try it.
Bye
-
I'm making an application for WinCE. I use lazarus 9.28.2 for Windows, and Kol-CE 2.80.3 I have a form with about 20 items TKOLLabel. I need to run this code
per i: = 0 count-1 do begin Self.ControlByName ( 'v' + IntToStr (i)).Hint : = 'AAAAA'; //Self is the form i: = i +1 end;
When completed (target = arm wince widget = SO = WinCE compiler = ppcrossarm) Error: identifier idents no member "ControByName" This code without using KOLCE work, so I would know how to convert it to use KOLCE
-
Maybe you didn't understand my previous reply. Go to project options and define a new conditional of USE NAMESHere is a test using KOL only (not the MCK):
program Test;
uses KOL;
type
PForm1 = ^TForm1;
TForm1 = object(TObj)
Form,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,V20,Butt on: PControl;
public
procedure ButtonClick(Sender: PObj);
end;
var
Form1: PForm1;
procedure NewForm1(var Result: PForm1; AParent: PControl);
begin
New(Result,Create);
with Result^ do
begin
Form := NewForm(AParent,'Test');
V1 := NewLabel(Form,'v1');
V2 := NewLabel(Form,'v2').PlaceRight;
V3 := NewLabel(Form,'v3').PlaceRight;
V4 := NewLabel(Form,'v4').PlaceRight;
V5 := NewLabel(Form,'v5').PlaceRight;
V6 := NewLabel(Form,'v6').PlaceDown;
V7 := NewLabel(Form,'v7').PlaceRight;
V8 := NewLabel(Form,'v8').PlaceRight;
V9 := NewLabel(Form,'v9').PlaceRight;
V10 := NewLabel(Form,'v10').PlaceRight;
V11 := NewLabel(Form,'v11').PlaceDown;
V12 := NewLabel(Form,'v12').PlaceRight;
V13 := NewLabel(Form,'v13').PlaceRight;
V14 := NewLabel(Form,'v14').PlaceRight;
V15 := NewLabel(Form,'v15').PlaceRight;
V16 := NewLabel(Form,'v16').PlaceDown;
V17 := NewLabel(Form,'v17').PlaceRight;
V18 := NewLabel(Form,'v18').PlaceRight;
V19 := NewLabel(Form,'v19').PlaceRight;
V20 := NewLabel(Form,'v20').PlaceRight;
V1.SetName(Form,'V1');
V2.SetName(Form,'V2');
V3.SetName(Form,'V3');
V4.SetName(Form,'V4');
V5.SetName(Form,'V5');
V6.SetName(Form,'V6');
V7.SetName(Form,'V7');
V8.SetName(Form,'V8');
V9.SetName(Form,'V9');
V10.SetName(Form,'V10');
V11.SetName(Form,'V11');
V12.SetName(Form,'V12');
V13.SetName(Form,'V13');
V14.SetName(Form,'V14');
V15.SetName(Form,'V15');
V16.SetName(Form,'V16');
V17.SetName(Form,'V17');
V18.SetName(Form,'V18');
V19.SetName(Form,'V19');
V20.SetName(Form,'V20');
Button := NewButton(Form,'Test').PlaceDown;
Button.OnClick := ButtonClick;
end;
end;
procedure TForm1.ButtonClick(Sender: PObj);
var
i: Integer;
c: PObj;
begin
for i := 1 to 20 do
begin
c := Form.FindObj('V'+Int2Str(i));
if c <> nil then
PControl(c).Text := 'zzz';
end;
c.Free;
end;
begin
Applet := NewApplet('Test');
NewForm1(Form1,Applet);
Run(Applet);
end.
-
I designed the GUI using the controls of the bar KOL. As I understand I should not use the controls at design time, but create them at runtime?
Use of controls at design time is not possible in my case?
thanks a lot for the time you've spent.
-
-
{ KOL MCK } // Do not remove this line! {$DEFINE KOL_MCK} {$ifdef FPC} {$mode delphi} {$endif} unit fmain;
interface
uses Windows, Messages, KOL {place your units here->} {$IFDEF LAZIDE_MCK}, Forms, mirror, Classes, Controls, mckCtrls, mckObjs, Graphics; {$ELSE} ; {$ENDIF}
type { TMain } {$I MCKfakeClasses.inc} {$IFDEF KOLCLASSES} TMain = class; PMain = TMain; {$ELSE OBJECTS} PMain = ^TMain; {$ENDIF CLASSES/OBJECTS} TMain = {$IFDEF KOLCLASSES}class{$ELSE}object{$ENDIF}({$IFDEF LAZIDE_MCK}TForm{$ELSE}TObj{$ENDIF}) Form: PControl; KOLMain: TKOLForm; KOLProject: TKOLProject;
v1 v2 - - - - v19 v20 - - - procedure KOLMainFormCreate(Sender: PObj); private { private declarations } public { public declarations } procedure CaricaDatiCalendario; end; var Main {$IFDEF KOL_MCK} : PMain {$ELSE} : TMain {$ENDIF} ;
{$IFDEF KOL_MCK} procedure NewMain( var Result: PMain; AParent: PControl ); {$ENDIF}
implementation
{$IFDEF KOL_MCK} {$I fmain_1.inc} {$ENDIF}
{ TMain } - - - procedure TMain.CaricaDatiCalendario; var i,k,x: Integer; sQuery,sTmp: String; c:PObj; begin - - - for i := 1 to nMesi do begin c := Form.FindObj('v' + Int2Str(i)); <--- Error here if c <> nil then PControl(c).Text :='zzz' end; - - - end;
error in compiling: Error: identifier idents no member "FindObj"
-
v1,v2.... are TKOLLabel
-
Go to project options and define a new conditional of USE NAMES
In project options where insert USE NAMES?
sorry my bad english
-
In Lazarus Project - Compiler options... - Other - Custom options Add -dUSE_NAMES
-
I did as you have written, but:
fmain_1.inc(19,17) Error: identifier idents no member "SetName"
thanks for all the help
-
Looks like a bug with Lazarus. In Lazarus IDE do this: - Menu: Package >> Open loaded package... - Select: MirrorKOLPackage >> Open... - Click Compiler Options >> Other - In Custom options add: -dUSE_NAMES - Click OK - Click Compile - When compile completed, close package window and try again
-
Ok!!! great!!!
Now...
v1..vxx: TKOLLabel
for i := 1 to nMesi do begin c := Form.FindObj('v' + Int2Str(i)); <--- Error here if c <> nil then PControl(c).Hint :='zzz' end;
fmain.pas(213,19) Error: identifier idents no member "hint"
"Hint" the property I need to store string data relating to the control.
thanks
-
You need to add another conditional define: USE_MHTOOLTIPSo now you will have: -dUSE_NAMES -dUSE_MHTOOLTIPThen rebuild. The correct syntax for tooltips is Hint.Text:
procedure TForm1.Button1Click(Sender: PObj);
var
i: Integer;
c: PObj;
begin
for i := 1 to 20 do
begin
c := Form.FindObj('Label'+Int2Str(i));
if c <> nil then
PControl(c).Hint.Text := 'Label'+Int2Str(i);
end;
MsgOK('Label hints added!');
end;
-
MirrorKOLPackage when compiling with-dUSE_MHTOOLTIP, error:
C:\lazarus\components\kol-ce-2.80.3\kol\KOLMHToolTip.pas(268,50) Error: Identifier not found "TTM_GETDELAYTIME"
thanks
-
TTM_GETDELAYTIME is defined in delphicommctrl.inc TTM_GETDELAYTIME = WM_USER + 21; but in KOL.PAS it is only enabled for Win32...
Try to add the relevant bits from delphicommctrl.inc to your unit. Hopefully Yury Sidorov (the maintainer of KOL-CE) will read this and fix it in the SVN.
-
sorry, My last message was wrong, MirrorKOLPackage compiling with -dUSE_MHTOOLTIP OK.
v1..vxx: TKOLLabel
for i := 1 to nMesi do begin c := Form.FindObj('v' + Int2Str(i)); if c <> nil then PControl(c).Hint.Text :='zzz' <--- Error here end;
still error:
fmain.pas(213,19) Error: identifier idents no member "Hint"
thanks
-
Sorry again. this error is present:
MirrorKOLPackage when compiling with-dUSE_MHTOOLTIP, error:
C:\lazarus\components\kol-ce-2.80.3\kol\KOLMHToolTip.pas(268,50) Error: Identifier not found "TTM_GETDELAYTIME" --------------------- You: Try to add the relevant bits from delphicommctrl.inc to your unit.
How can I do?
thanks
-
Open KOLMHToolTip.pas Find line 154: const
Dummy = 0; Insert copied text from delphicommctrl.inc on next line:
TTM_ADDTOOLW = WM_USER + 50;
TTM_DELTOOLW = WM_USER + 51;
TTM_NEWTOOLRECTW = WM_USER + 52;
TTM_GETTOOLINFOW = WM_USER + 53;
TTM_SETTOOLINFOW = WM_USER + 54;
TTM_HITTESTW = WM_USER + 55;
TTM_GETTEXTW = WM_USER + 56;
TTM_UPDATETIPTEXTW = WM_USER + 57;
TTM_ENUMTOOLSW = WM_USER + 58;
TTM_GETCURRENTTOOLW = WM_USER + 59;
TTM_WINDOWFROMPOINT = WM_USER + 16;
TTM_TRACKACTIVATE = WM_USER + 17; TTM_TRACKPOSITION = WM_USER + 18; TTM_SETTIPBKCOLOR = WM_USER + 19;
TTM_SETTIPTEXTCOLOR = WM_USER + 20;
TTM_GETDELAYTIME = WM_USER + 21;
TTM_GETTIPBKCOLOR = WM_USER + 22;
TTM_GETTIPTEXTCOLOR = WM_USER + 23;
TTM_SETMAXTIPWIDTH = WM_USER + 24;
TTM_GETMAXTIPWIDTH = WM_USER + 25;
TTM_SETMARGIN = WM_USER + 26; TTM_GETMARGIN = WM_USER + 27; TTM_POP = WM_USER + 28;
TTM_POPUP = WM_USER + 34;
TTM_UPDATE = WM_USER + 29;
Hope it works!
-
Will try today.
Thanks for your help and quick response.
thanks
-
great!
The compilation is OK!
Then try the application on the device
thank you very much!
-
Prego!
-
I tried
compilation is ok
when I run on device(windows mobile 2003 SE) error Access Violation:
PControl(c).Caption := 'AAA';
Help me
grazie
-
Some ideas to solve?
thanks
-
Sorry, but I have no mobile device to test with. Can you provide more details of the error? Are you sure that the device can actually show tooltips?
-
The device does not support tooltips.
But the error occurs:
PControl(c).Caption := 'AAA'; <-- Error here
without using the tooltips
The device shows only AccessViolation
thanks
-
Sorry about the tooltips - I misread your post. I have downloaded and installed a Win-CE emulator to test. I could not find ROM images for Windows Mobile 2003 SE so I tested with Windows Mobile 6 Professional (ARM920T). The code works correctly and without errors for me. Here is a link to my Lazarus project and compiled exe for you to test: http://www.sendspace.com/file/xxlrzj
-
You: I have downloaded and installed a Win-CE emulator to test.
Where can I find the emulator? how I install it? as I run it? thanks
-
-
now works. I indicated a different subject.
Excellent work. thanks
-
PControl(cl).Hint.Text :='AAA'
Compilazione ok, Esecuzione Ok.
but whatever value do to the string is not stored, without giving error.
Use the 'Hint' to store strings. I must not see the hints. I use them as tags. any suggestions to workaround the problem?
thanks
-
I solved using arrays of strings.
thanks
-
> Use the 'Hint' to store strings. I must not see the hints. > I use them as tags.
You can use the CustomData property:
Set: PControl(c).CustomData := PKOLChar('String to store as tag'); Get: MsgOK(PKOLChar(PControl(c).CustomData));
Nice and easy. No need for additional arrays ;-)
-
good!
thank you so much!
ciao.
|