Compilermeldung: tui.inc(12,20) Error: constructors, destructors and class operators must be methods

Für Fragen zur Programmiersprache auf welcher Lazarus aufbaut
Antworten
multiplatform-coder
Beiträge: 59
Registriert: Do 20. Apr 2023, 18:25

Compilermeldung: tui.inc(12,20) Error: constructors, destructors and class operators must be methods

Beitrag von multiplatform-coder »

Warum bekomme ich diese Fehlermeldung vom Compiler?

Ich weiß dass es class functions gibt. Auch class procedures, aber nichts dergleichen habe ich definiert. Was muss ich einstellen um normale constructors und destructors der Klassen verwenden zu können?


multiplatform-coder
Beiträge: 59
Registriert: Do 20. Apr 2023, 18:25

Re: Compilermeldung: tui.inc(12,20) Error: constructors, destructors and class operators must be methods

Beitrag von multiplatform-coder »

Hat das was nit noch nicht erlaubten Punkten in Unitnamen zu tun?

Habe mir mal erlaubt das hier auszuprobieren:

Code: Alles auswählen

{$MODE OBJFPC}{$H+}
unit tui.Core;
interface
uses 
    classes, custapp, fgl, tools, vipgfx, myTTF;

const 

	tuiVer = '2.0.1c';

	tuiMouseClickDelay = 256;

	tuiIDcounter : dword = 0;	

type

	TtuiBoxType = (
					tuiBoxStd,
					tuiBoxStatic,
					tuiBoxStaticBackground
				  );

	PObject = ^TObject;

	TtuiBox = class;


	TtuiExecProc = procedure(const param:string) of object;


	TtuiThemeTUI = record

			tui_StandartFontSize : byte;
	
	end;


	TtuiMessageType = (
	
			tuiMessageEmptyQueue,
			tuiMessageNone,
			tuiMessageDialogInit,
			tuiMessageCloseDialog

			);

	TtuiMessage = record

			messageType : TtuiMessageType;
			messageFunction : string;
			messageData : pointer;

	end;

        TtuiMessages = array of TtuiMessage;


	TtuiSharedParameters = record

			mouseClickTime2Pass : qword;
	
	end;


	TtuiTUI = class(TComponent)

                private

                //function GetQueueMsg(Index: Integer): TtuiMessage;

                //procedure SetQueueMsg(Index: Integer; AValue: TtuiMessage);

		function countBoxes: dword;

		procedure destroyBoxes;

		function getlastbox: TtuiBox;

		procedure sortBox2last(id: dword);
		procedure sortBox2first(id: dword);

		function isLastBox(theBox: TtuiBox): boolean;

		procedure deleteBox(Box: TtuiBox);

		function createThemeTui: TtuiThemeTui;

		public
	
			FThemeTui : TtuiThemeTUI;

			fscreen : gfxImage;

			fboxes : TtuiBox;

			fmainFont : ttfFont;
		
			fdrawOnly : boolean;

			flockedItem : longint;
			flockedBox : longint;



			fpleaseActivate : boolean;
			factivationAllowed : boolean;
			
			fpleaseDragg : boolean;
			fdraggingAllowed : boolean;
			
			fmessageQueue : TtuiMessages;

			foldMouseX : longint;
			foldMouseY : longint;
			foldMouse2X : longint;
			foldMouse2Y : longint;

			fdontHighLight : boolean;

		 	constructor create(theScreen: gfxImage; fontFileName: string);
                        //constructor create_owner(aowner: TComponent; theScreen: gfxImage; fontFileName: string);
			destructor destroy; override;
			

			function peekMessage: TtuiMessage;
			function getMessage: TtuiMessage;
			procedure postMessage(message: TtuiMessage);
			function processStandartMessages: boolean;
			procedure dropMessage(message: TtuiMessage);
			procedure processFinalMessages;
			function MessageEqu(a, b: TtuiMessage): boolean;
			function findMessage(message: TtuiMessage): boolean;


			procedure addBox(aBox: TtuiBox);
			procedure closeBox(var aBox: TtuiBox);
			
			procedure draw;
			procedure update;


			function getBoxByID(theID: dword): TtuiBox;
			function getBoxByName(const theName: string): TtuiBox;

			
			procedure lockItem(num: longint);
			procedure freeItem;

			procedure lockBox(num: dword);
			procedure freeBox;


			function getSharedParameters: TtuiSharedParameters;
			procedure setSharedParameters(params: TtuiSharedParameters);


			function isInAnyBox: boolean;
			function is2InAnyBox: boolean;

			function isInAnyBoxExcept(boxID : longint): boolean;
			function is2InAnyBoxExcept(boxID : longint): boolean;


			property ThemeTui : TtuiThemeTUI read FThemeTUI;

			property screen : gfxImage read FScreen;

			property boxes : TtuiBox read FBoxes;

			property mainFont : ttfFont read FMainFont;

			property drawOnly : boolean read FdrawOnly;

			property lockedItem : longint read FLockedItem;
			property lockedBox : longint read FLockedBox;



			property pleaseActivate : boolean read FpleaseActivate write FpleaseActivate;
			property activationAllowed : boolean read factivationallowed write factivationallowed;

			property pleaseDragg : boolean read fpleaseDragg write fpleaseDragg;
			property draggingAllowed : boolean read fdraggingAllowed;

			//property messageQueue[Index: Integer] : TtuiMessage read GetQueueMsg write SetQueueMsg;

			property oldMouseX : longint read foldmouseX;
			property oldMouseY : longint read foldmouseY;
			property oldMouse2X : longint read foldmouse2X;
			property oldMouse2Y : longint read foldmouse2Y;

			property dontHighLight : boolean read fdontHighLight;


	end;


	TtuiThemeBox = record

			ActivateBorderUse : boolean;
			ActivateBorderColor : dword;
			ActivateBorderInitial : dword;

			DockOnScreenBorder : boolean;


			FontColorForderground : dword;
			BackgroundColor : dword; 

			LeftTopBorderColor : dword;
			RightBottomBorderColor : dword;

			HintTextColor : dword;
			HintBackgroundColor : dword;

	end;



	TtuiBox = class(TComponent)
                private
                        FBoxType : TtuiBoxType;
			FBoxID : dword;
			FBoxName : string;

			FBoxEnabled : boolean;

			FboxX, FboxY : longint;
			FboxWidth, FboxHeight : dword;

			FTUISelf : TtuiTUI;

			FThemeBox : TtuiThemeBox;


			Factive : boolean;

			FnextBox : TtuiBox;
			FlastBox : TtuiBox;

			Fitems : TtuiBox;

			FmouseInNirvana : boolean;

			Fdragging : boolean;


			FisReservedZone : boolean;

                        activationCount : integer;

                        doClose : boolean;

                        lockedDragging : boolean;

                        procedure dragBox;

                        procedure deactiveAllBoxes;
                        procedure deactivateDraggingAllBoxes;

                        procedure updateItems;
                        procedure drawItems;

		public

			reservedZone : record
							X1, Y1 : longint;
							X2, Y2 : longint;
							id : dword;
						   end;

			procedure addReservedZone(x1, y1, x2, y2: longint; id: dword);
			procedure freeReservedZone;
			function isInReservedZone(id: dword): boolean;

			function getNextItem: TtuiBox; virtual;
			procedure setNextItem(item: TtuiBox); virtual;
			
			function getItemID: dword; virtual;
			function getItemType: string; virtual;

			
			constructor create(theTuiSelf: TtuiTUI; posX, posY: longint; theBoxWidth, theBoxHeight: dword; theName: string; theType: TtuiBoxType);
			destructor destroy; override;

			procedure addItem(item: TtuiBox);


			function update: boolean; virtual;
			procedure draw; virtual;

			
			function createThemeBox: TtuiThemeBox;


			function isInBox(theBox: TtuiBox): TtuiBox;
			function is2InBox(theBox: TtuiBox): TtuiBox;


			procedure isMouseInNirvana;
			procedure activateBox;			
			
			function isDraggingAnyBox: boolean;

			procedure lockDragging;
			procedure freeDragging;

			function isMouseInBox: boolean;
			function isMouse2InBox: boolean;


                	property BoxType : TtuiBoxType read FBoxType;
			property BoxID : dword read FBoxID;
			property BoxName : string read FBoxName;

			property BoxEnabled : boolean read FBoxEnabled;

			property boxX : Longint read FBoxX;
                        property boxY : longint read FBoxY;
			property boxWidth : dword read FBoxWidth;
                        property boxHeight : dword read FBoxHeight;

			property TUISelf : TtuiTUI read FTUIself;

			property ThemeBox : TtuiThemeBox read FThemeBox;


			property active : boolean read FActive;

			property nextBox : TtuiBox read fnextbox;
			property lastBox : TtuiBox read flastbox;

			property items : TtuiBox read fitems;

			property mouseInNirvana : boolean read FMouseInNirvana;

			property dragging : boolean read Fdragging write Fdragging;


			property isReservedZone : boolean read FisReservedZone;

	end;


implementation
uses 
	sysutils, tui.Dialog.MessageBox;

type
  TtuiBoxes = specialize TFPGObjectList<TtuiBox>;
  
var  
  TuiBoxes: TtuiBoxes; 
  
function compare_ascending(const item1,item2: TtuiBox): integer;
function compare_descending(const item1,item2: TtuiBox): integer;  

{$I tui.inc}
{$I tui.Box.inc}
{$I tui.Message.inc}

begin
end.

Code: Alles auswählen

{
function TtuiTUI.GetQueueMsg(Index: Integer): TtuiMessages;
begin
   Result := fmessagequeue[Index].messageData;
end;

procedure TtuiTUI.SetQueueMsg(Index: Integer; AValue: TtuiMessages);
begin

end;
}
constructor TtuiTUI.create(theScreen: gfxImage; fontFileName: string);
begin

        inherited create(nil);
	ThemeTui:= createThemeTui;
	boxes:= TtuiBox.Create(self,0,0,0,0,'',TuiBoxStd);
  	if fontFileName <> '' then ttfCreateFont(fontFileName, ThemeTui.Tui_StandartFontSize, mainFont);
  	screen:= theScreen;
  	lockedItem:= -1;
  	lockedBox:= -1;
  	drawOnly:= false;
  	mouseClickDelay:= tuiMouseClickDelay;
  	dontHighLight:= false;

end;
{
constructor TtuiTUI.create_owner(aowner: tcomponent; theScreen: gfxImage; fontFileName: string);
begin

    inherited create(aowner);
	ThemeTui:= createThemeTui;
	boxes:= TtuiBox.Create(self,0,0,0,0,'',TuiBoxStd);
  	if fontFileName <> '' then ttfCreateFont(fontFileName, ThemeTui.Tui_StandartFontSize, mainFont);
  	screen:= theScreen;
  	lockedItem:= -1;
  	lockedBox:= -1;
  	drawOnly:= false;
  	mouseClickDelay:= tuiMouseClickDelay;
  	dontHighLight:= false;

end;
}

function TtuiTUI.createThemeTui: TtuiThemeTui;
begin

	result.Tui_StandartFontSize:= 31;

end;


function TtuiTUI.getSharedParameters: TtuiSharedParameters;
begin

	result.mouseClickTime2Pass:= mouseTime2Pass;

end;


procedure TtuiTUI.setSharedParameters(params: TtuiSharedParameters);
begin

	mouseTime2Pass:= params.mouseClickTime2Pass;

end;


procedure TtuiTUI.lockItem(num: longint);
begin

	lockedItem:= num;

end;


procedure TtuiTUI.freeItem;
begin

	lockedItem:= -1;

end;

procedure TtuiTUI.lockBox(num: dword);
begin

	lockedBox:= num;

end;

procedure TtuiTUI.freeBox;
begin

	lockedBox:= -1;

end;


procedure TtuiTUI.destroyBoxes;
var 
	box : TtuiBox;
	prevbox : TtuiBox;

begin
    {
	if countBoxes <> 0 then begin
		box:= boxes;
		while assigned(box) do begin
			prevbox:= box;
			box:= prevbox.nextBox;
			prevbox.free; 
			prevbox:= nil;
		end;
	end;
    }
    Boxes.Free;
    
end;


destructor TtuiTUI.destroy;
begin

	destroyBoxes;
	
	ttfCloseFont(mainFont);	

end;


function TtuiTUI.countBoxes: dword;
var 
	box : TtuiBox;

begin
    {
	result:= 0;
	box:= boxes;
	while assigned(box) do begin
		inc(result);
		box:= box.nextBox;
	end;
    }
    result := Boxes.ComponentCount;
end;


procedure TtuiTUI.closeBox(var aBox: TtuiBox);
var 
	box : TtuiBox;
    idx : Integer;  //hinzugefügt (added) : Thomas Schönfelder
begin
    {
	box:= boxes;
	while assigned(box) do begin
		if box = aBox then begin
			box.doClose:= true;
			aBox:= nil;
			exit;
		end;
		box:=box.nextBox;
	end;
    }
    idx := 0;
    box := TtuiBox(boxes.Components[idx]);
    while assigned(box) do
    begin
		if box = aBox then begin
			box.doClose:= true;
			boxes.RemoveComponent(aBox);
            aBox:= nil;
			exit;
        end;
        inc(idx);
        if idx < boxes.ComponentCount then box := TtuiBox(boxes.Components[idx]) else box := nil;         
    end;

end;



function TtuiTUI.isLastBox(theBox : TtuiBox): boolean;
var 
	box : TtuiBox;
	i : dword;

begin
    {
	result:= false;
	i:= 0;
	box:= boxes;
	while assigned(box) do begin
		inc(i);
		
		if theBox.BoxID = box.BoxID then begin
			break;
		end;

		box:= box.nextBox;
	end;
	if i = countBoxes then result:= true;
    }
    result := false;
    i := 0;
    box := TtuiBox(boxes.Components[i]);
    while assigned(box) do
    begin
       inc(i);
		if theBox.BoxID = box.BoxID then begin
			break;
		end;
        if i<boxes.ComponentCount then box:=TtuiBox(boxes.Components[i]) else //box.nextBox;
        begin 
          if i>=countBoxes then result := true;
          Box := nil;
        end; 
    end;
    
end;



procedure TtuiTUI.addBox(aBox: TtuiBox);
label 
	lActivateBox;

var 
	box : TtuiBox;
    prevbox : TtuiBox;
    lastbox : TtuiBox;

begin
    {
	lastbox:= nil;
	box:= boxes;

	if not assigned(box) then begin
		aBox.lastBox:= nil;
		aBox.nextBox:= nil;
		boxes:= aBox;
		goto lActivateBox;
	end;

	while assigned(box) do begin
      	if box.nextbox <> nil then lastbox:= box;
      	prevbox:= box;
 	   	box:= box.nextbox;
	end;

	abox.lastbox:= prevbox;
  	prevbox.lastbox:= lastbox;
  	prevbox.nextbox:= abox;
  	

lActivateBox:
  	aBox.activateBox;
    }
    boxes.InsertComponent(aBox);
end;

procedure TtuiTUI.draw;
var 
	box : TtuiBox;
	idx : Integer;   //hinzugefügt (added) Thomas Schönfelder

begin
	
	idx := 0;
	box:=TtuiBox(boxes.Components[idx]);
	if assigned(box) then
	while (assigned(box) and (idx < countboxes)) do begin
		
		box.draw;
		box.drawItems;

        inc(idx);
		if idx<boxes.ComponentCount then box := TtuiBox(boxes.Components[idx]) else box := nil; //box.nextBox;   //geändert Thomas Schönfelder
	end;

end;

procedure TtuiTUI.update;
var 
	box : TtuiBox;
    ix: integer;

procedure updateBox;
label 
	topBox;	
	
begin

topBox:
	if not drawOnly then begin
		if ix<boxes.ComponentCount then box:= TtuiBox(boxes.Components[ix]) else box := nil;
		if assigned(box) then
		while assigned(box) do begin

			if box.update then goto topBox;
            inc(ix);
			if ix<boxes.ComponentCount then box:= TtuiBox(Boxes.Components[ix]) else box := nil; //box.nextBox;
		end;
	end;

end;

begin
    ix := 0;
	while processStandartMessages do ;

	updateBox;
	//draw;       //geändert am 31.05.2024 nachdem Kirill Kranz diese Änderung in seinem Code vorgenommen hat, geändert hier von Thomas Schönfelder

	if not drawOnly then begin

		activationAllowed:= false;
		if pleaseActivate then activationAllowed:= true;
		draggingAllowed:= false;


		if pleaseDragg and (lockedItem = -1) then draggingAllowed:= true;


		if not mouseL then begin
			freeItem;
			freeBox;
			pleaseDragg:= false;
		end;
		
	end;


	oldMouseX:= mouseX;
	oldMouseY:= mouseY;
	oldMouse2X:= mouse2X;
	oldMouse2Y:= mouse2Y;

end;


function TtuiTUI.getlastbox: TtuiBox;
var 
	aBox : TtuiBox;

begin
    {
	result:= nil;
	aBox:= boxes;
	while assigned(aBox) do begin
		result:= aBox;
		aBox:= aBox.nextBox;             
   end;
   }
   Result := TtuiBox(boxes.Components[Boxes.ComponentCount-1]);
end;

function compare_ascending(const item1,item2: TtuiBox): integer;
begin
  if item1.BoxID > item2.BoxID then
  Result := 1 else
  if item1.BoxID < item2.BoxID then
  Result := -1 else
  Result := 0;
end;

function compare_descending(const item1,item2: TtuiBox): integer;  
begin
  if item1.BoxID > item2.BoxID then
  Result := -1 else
  if item1.BoxID < item2.BoxID then
  Result := 1 else
  Result := 0;
end;

procedure TtuiTUI.sortBox2last(id: dword);
var

	aBox, prev : TtuiBox; ix: Integer;
	savedBox : TtuiBox;
	thelastbox : TtuiBox;
    
    tuiboxes: TtuiBoxes;

begin
    ix := 0;
	if boxes = nil then exit;
    {
	if boxes.nextBox = nil then exit;
	
	aBox:= boxes;
	thelastbox:= getlastbox;

	if ID = thelastbox.BoxID then exit;
    }
    aBox := Boxes.Components[ix];
	while assigned(aBox) do begin

		//if aBox.BoxID = id then begin	
        		
			tuiboxes.add(aBox);
			
            {
        	if not assigned(aBox.lastbox) then begin
				boxes:= boxes.nextbox;
				boxes.lastbox:= nil;
				thelastbox.nextbox:= abox;
				abox.nextbox:= nil;
				abox.lastbox:= thelastbox;
				exit;
      	   	end;

			savedBox:= aBox;

			abox.lastBox.nextBox:= abox.nextBox;
			abox.nextBox.lastBox:= abox.lastBox;
			}
		//end;
        
        inc(ix); if ix >= Boxes.ComponentCount then aBox := nil else aBox := Boxes.Components[ix];
		
        //prev:= aBox;
		//aBox:= aBox.nextBox;             
    end;
    {
 	if not assigned(savedBox) then exit;

	savedBox.nextBox:= nil;
	savedBox.lastBox:= prev;
	prev.nextBox:= savedBox;
    }
    tuiboxes.sort(@compare_descending);
    for ix := 0 to Boxes.ComponentCount-1 do Boxes.RemoveComponent(Boxes.Components[ix]);
    for aBox in tuiboxes do Boxes.InsertComponent(aBox);
    tuiboxes.free;
end;


procedure TtuiTUI.sortBox2first(id: dword);
var
	aBox : TtuiBox;
	savedBox : TtuiBox;
	tuiboxes: Ttuiboxes;  ix: integer;

begin
    ix:=0;
	if boxes = nil then exit;
	{
	if boxes.BoxID = id then exit;
    }
	aBox:= boxes.Components[ix];
	while assigned(aBox) do begin
	}
	    tuiboxes.add(aBox);
	    inc(ix); if ix >= Boxes.ComponentCount then aBox := nil else aBox := Boxes.Components[ix];
	{
		if aBox.BoxID = id then begin
			savedBox:= aBox;
			break;
		end;
		aBox:= aBox.nextBox;
    }                
   end;
	{
   	if assigned(aBox.nextBox) then aBox.nextBox.lastBox:= savedBox.lastBox;
   	if assigned(aBox.lastBox) then aBox.lastBox.nextBox:= savedBox.nextbox;

   	savedBox.lastBox:= nil;
   	savedBox.nextBox:= boxes;
   	boxes:= savedBox;
    }
    
   tuiboxes.sort(@compare_ascending);
   for ix := 0 to Boxes.ComponentCount-1 do Boxes.RemoveComponent(Boxes.Components[ix]);
   for aBox in tuiboxes do Boxes.InsertComponent(aBox);
   tuiboxes.free;     
end;


function TtuiTUI.getBoxByID(theID: dword): TtuiBox;
var 
	aBox : TtuiBox; ix: integer;
begin
    ix := 0;
	aBox:= TtuiBox(boxes.Components[ix]);
	while assigned(aBox) do begin 
		if aBox.BoxID = theID then begin
			result:= aBox;
			exit;
		end;
		inc(ix);
		if ix < boxes.ComponentCount then aBox:= TtuiBox(boxes.Components[ix]) else abox := nil;
	end;
	gfxError('Box by ID ' + numstr(theID) + ' not found!');
	result:= nil;

end;


function TtuiTUI.getBoxByName(const theName: string): TtuiBox;
var 
	aBox : TtuiBox; ix: integer;

begin
    ix := 0;
	aBox:= TtuiBox(boxes.Components[ix]);
	while assigned(aBox) do begin 
		if aBox.boxName = theName then begin
			result:= aBox;
			exit;
		end;
		inc(ix);
		if ix < boxes.ComponentCount then aBox:= TtuiBox(Boxes.Components[ix]) else aBox := nil;
	end;
	gfxError('Box ' + theName + ' not found!');
	result:= nil;

end;


procedure TtuiTUI.deleteBox(Box: TtuiBox);
var 
	aBox : TtuiBox;
	savedBox : TtuiBox;
    ix: Integer;
begin
    {
	aBox:= boxes;
	if not assigned(aBox) then exit;
	
	while assigned(aBox) do begin
		
		if aBox.BoxID = box.BoxID then begin
		
			savedBox:= aBox;

            if not assigned(aBox.lastbox) then begin
					boxes:= boxes.nextbox;
					if assigned(boxes) then boxes.lastbox:= nil;
									
					break;
	        end;

 		   	abox.lastBox.nextBox:= abox.nextBox;

			if assigned(aBox.nextbox) then abox.nextBox.lastBox:= abox.lastBox;

		end;

		aBox:= aBox.nextBox;
    end;

	savedBox.free; 
	savedBox:= nil;

	aBox:= getLastBox;
	if assigned(aBox) then aBox.activateBox;
    }
    
    ix := 0;
     
      while ix < boxes.ComponentCount do
      begin
        if assigned(boxes.components[ix]) then
          if Box.BoxID = TtuiBox(boxes.Components[ix]).BoxID then
          begin
            boxes.RemoveComponent(boxes.Components[ix]);
            break; 
          end
        else inc(ix); 
      end; { von while }
end;


function TtuiTUI.isInAnyBox: boolean;
var 
    aBox : TtuiBox; ix: integer;

begin

    result:= false;

    ix := 0; aBox:= TtuiBox(boxes.Components[ix]);
    
    while assigned(aBox) do begin
        if aBox.isMouseInBox then begin
            result:= true;
            exit;
        end;
        inc(ix); if ix < boxes.ComponentCount then aBox:= TtuiBox(boxes.Components[ix]) else abox := nil;
    end;

end;


function TtuiTUI.is2inAnyBox: boolean;
var 
    aBox : TtuiBox; ix: integer;

begin
    ix := 0;

    result:= false;

    aBox:= TtuiBox(boxes.Components[ix]);
    
    while assigned(aBox) do begin
        if aBox.isMouse2InBox then begin
            result:= true;
            exit;
        end;
        inc(ix); if ix < boxes.ComponentCount then aBox:= TtuiBox(boxes.Components[ix]) else aBox := nil;
    end;

end;

function TtuiTUI.isInAnyBoxExcept(boxID: longint): boolean;
var 
    aBox : TtuiBox; ix: integer;

begin
    ix := 0;

    result:= false;

    aBox:= TtuiBox(boxes.Components[ix]);
    
    while assigned(aBox) do begin
        if aBox.isMouseInBox then begin
            if aBox.boxID <> boxID then begin
            	result:= true;
            	exit;
           	end;
        end;
        inc(ix); if ix < boxes.ComponentCount then aBox:= TtuiBox(boxes.Components[ix]) else aBox := nil;
    end;

end;


function TtuiTUI.is2InAnyBoxExcept(boxID: longint): boolean;
var 
    aBox : TtuiBox; ix: integer;

begin
    ix:=0;
    result:= false;

    aBox:= TtuiBox(boxes.Components[ix]);
    
    while assigned(aBox) do begin
        if aBox.isMouse2InBox then begin
            if aBox.boxID <> boxID then begin
            	result:= true;
            	exit;
           	end;
        end;
        inc(ix); if ix < boxes.ComponentCount then aBox:= TtuiBox(boxes.Components[ix]) else aBox := nil;
    end;

end;
irgendein User hier hat kürzlich nach Eurer Meineung dazu gefragt. Die Meinung war zwar negativ, ich habe es dennoch mal getestet und Komponenten daraus gemacht. Die lassen sich nun icht übersetzen. Ich frage mich, warum? Das Problem ist der angegebene Compilerfehler. Das Original ist aber im Gegensatz zu der Usermeinung die so negativ war, durchaus übersetzbar.

Wie gut oder schlecht ist dieser Entwurf? Lohnt es sich damit weiter zu machen oder taugt dieser Entwurf von vornherin nix. Ist also ein Neuentwurf erfolg-versprechender?

Hat ja wiederum keinen Sinn wenn ein Fehler nach dem Anderen auftritt! Und das nur weil das Design fehlerhaft ist!

Im Quellcode auskommentiertes ist von mir geändert und der alte Code auskommentiert.

Die beiden ersten Methoden Get/Set MessageQueue wurden von mir hinzugefügt, weil das anfängliche Feld messagequeue ein array of record ist, worauf ich eine Array Eigenschaft abgeleitet habe, die aber will auch noch nicht funktionieren, daher vorerst auskommentiert und aus der Klassendefinition entfernt. Willl erst mal wissen warum ich den angegebenen Compilerfehler erhalte. Mehr vorerst nicht, Vielleicht muss ich ja das Design komplett neu machen. Sollte ich das auch?

multiplatform-coder
Beiträge: 59
Registriert: Do 20. Apr 2023, 18:25

Re: Compilermeldung: tui.inc(12,20) Error: constructors, destructors and class operators must be methods

Beitrag von multiplatform-coder »

@theo: Ich hatte im "Eifer des Gefechts einen Punkt zu viel im Quellcode, an einer Stelle an der ich das nicht vermutet hatte, weshalb ich da an dieser Stelle auch nicht geguckt habe.

thosch
Beiträge: 328
Registriert: Mo 10. Jul 2017, 20:32

Re: Compilermeldung: tui.inc(12,20) Error: constructors, destructors and class operators must be methods

Beitrag von thosch »

Was ist Tui und was ist TuiTUI?

Antworten