Recent

Author Topic: is it possible to open windows dialog in laz?  (Read 495 times)

Laur

  • New Member
  • *
  • Posts: 35
is it possible to open windows dialog in laz?
« on: July 09, 2024, 06:32:54 pm »
I think about something like this:

class/object TWinDlg : TForm (or something else - nonrelewant)

function Execute; // but it creates the window based on the win resource: with buttons, texts, lists, ect... not on the L/VCL

// and additionaly I need some messages to process, for example:

WMDrawItem... for an ownerdraw controls

ButtonClick
Sel change for ListBox/combo item, ...

generally: any control's notyfications.

.........

I have plenty of dialogs defined in rc, and I don't want to reproduce these in the V/LCL, because it's rather stupid to drawing thise all again. :)


Handoko

  • Hero Member
  • *****
  • Posts: 5290
  • My goal: build my own game engine using Lazarus
Re: is it possible to open windows dialog in laz?
« Reply #1 on: July 09, 2024, 07:12:26 pm »
Sure you can.

First you need to know how to runtimely create a form. Try this demo if you don't know how to do  it:
https://forum.lazarus.freepascal.org/index.php/topic,52725.msg389274.html#msg389274

Then you need to know how to do the data storing and loading. You mentioned RC, here have a very basic image loading from RC demo:
https://forum.lazarus.freepascal.org/index.php/topic,42144.msg293579.html#msg293579

And the most difficult thing is setting events runtimely:
https://forum.lazarus.freepascal.org/index.php/topic,54548.15.html

All the ingredients have been given, a chef is needed. You need combine them together to get the result.

Laur

  • New Member
  • *
  • Posts: 35
Re: is it possible to open windows dialog in laz?
« Reply #2 on: July 09, 2024, 09:19:51 pm »
OK. But I not intended to create any special events, but rather and simply get these messages in the fly - from (windows) sys.


for example:

function Message(...);

and I simply verify what it is:

if msg = LBN_SELCHANGE and id = 177 then ...

https://learn.microsoft.com/en-us/windows/win32/controls/lbn-selchange

I don't want to create any duplicate objects of the win controls in a dlg/win - pure messages, nothing more!

After all in Laz must exist some (virtual/dynamic) func. which gets these mesages, so I just need replace it - override only, nothing more.

Handoko

  • Hero Member
  • *****
  • Posts: 5290
  • My goal: build my own game engine using Lazarus
Re: is it possible to open windows dialog in laz?
« Reply #3 on: July 09, 2024, 09:28:41 pm »
I'm sorry I am not good in message accessing. I cannot help. But I know KodeZwerg is good in this topic, maybe he can help.

For example this is one of his post:
https://forum.lazarus.freepascal.org/index.php/topic,62988.msg476708.html#msg476708

 

TinyPortal © 2005-2018