Forum > CustomDrawn

How do I use customdraw / compiler error

(1/1)

MISV:
First I do;

IDEMacro - LCLWidgetType:=customdrawn
in "project settings" and "application overrides and defines"

Then


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---initialization  {$IFDEF mymsFPCDevTool}  // http://wiki.freepascal.org/Lazarus_Custom_Drawn_Controls#Custom_Drawn_Packages  customdrawndrawers.DefaultStyle := dsWin2000;  {$ENDIF} 


However, when compiling I get error

Quote
customdrawnobject_win.inc(590,78) Error: Incompatible type for arg no. 4: Got "<address of procedure(QWord;QWord;QWord;LongWord);StdCall>", expected "<procedure variable type of procedure(QWord;LongWord;QWord;LongWord);StdCall>"

at
Code: Pascal 
TimerInfo^.TimerID := Windows.SetTimer(0, 0, Interval, @TimerCallBackProc);

which is line 590 in unit customdrawnobject_win.inc



If I read the documentation correctly - I should be able too combine dsWindows7 drawing (where I can select a theme somehow?) with by installing http://wiki.freepascal.org/BGRAControls since that contains a drawer? Is that correct? I would love if I could thme my Win+Mac app in a custom theme/style/skin somehow




Remy Lebeau:

--- Quote from: MISV on May 23, 2017, 02:07:47 pm ---However, when compiling I get error

Quote
customdrawnobject_win.inc(590,78) Error: Incompatible type for arg no. 4: Got "<address of procedure(QWord;QWord;QWord;LongWord);StdCall>", expected "<procedure variable type of procedure(QWord;LongWord;QWord;LongWord);StdCall>"

at
TimerInfo^.TimerID := Windows.SetTimer(0, 0, Interval, @TimerCallBackProc);

which is line 590 in unit customdrawnobject_win.inc

--- End quote ---

It is pretty obvious what the error is.  TimerCallBackProc() is not declared correctly, its 2nd parameter is a QWord when a LongWord is expected instead.  This is the official callback declaration in the Win32 API:


--- Code: ---VOID CALLBACK TimerProc(
  _In_ HWND     hwnd,
  _In_ UINT     uMsg,
  _In_ UINT_PTR idEvent,
  _In_ DWORD    dwTime
);

--- End code ---

UINT and DWORD are always 32-bit in size, whether compiling for 32-bit or 64-bit systems.  On a 32-bit system, HWND and UINT_PTR are 32-bit in size.  On a 64-bit system, they are 64-bit in size.  Since the error message shows the 1st and 3rd parameters are QWord, the code is clearly being compiled for 64-bit.

Without actually seeing the declaration off TimerCallBackProc() in customdrawnobject_win.inc, my guess is that it is using UINT_PTR instead of UINT for the 2nd parameter.

MISV:
From that I can probably conclude not many people use customdraw. I was hoping I had setup something wrong. I will make a bug report later.


The other at least as important part of my question was this:


--- Quote ---If I read the documentation correctly - I should be able too combine dsWindows7 drawing (where *I* can select a custom sub style somehow?) by installing http://wiki.freepascal.org/BGRAControls since that contains a drawer? Is that correct? I would love if I could theme my Win+Mac app in a custom theme/style/skin somehow
--- End quote ---

But not sure if that works yet or something still being worked on.

MISV:
For what it is worth - I have submitted a bug report here:

https://bugs.freepascal.org/view.php?id=31968

The version I have is 1.6.4 - I guess it may have been fixed in the meantime, but now the bug report is there at least

Bart:

--- Quote from: MISV on June 05, 2017, 03:44:16 pm ---For what it is worth - I have submitted a bug report here:

https://bugs.freepascal.org/view.php?id=31968

--- End quote ---

Please look at my remarks there.

Bart

Navigation

[0] Message Index

Go to full version