samyeyo / LuaRT

Open source Windows programming framework for Lua
https://www.luart.org
Other
285 stars 17 forks source link

Final Window Creation in the First Executable Crashes #72

Closed CraneStyle closed 1 year ago

CraneStyle commented 1 year ago

At the point where you use QuickRT, performing the last command of the introduction win:show().

Expected: A window pops up with the title name of what I passed in when i created the window

Result: A window pops up with the title of what i expected, and immediately goes into a "Not responding" state, then shortly crashes QuickRT and the window at the same time.

samyeyo commented 1 year ago

Hi CraneStyle,

Thank you for the report.

The fact that the just created Window don't respond to the user is expected (user interaction is managed through the ui.update() method call), but it shouldn't crash (I have test it right now and it doesn't crash on my side).

Once you called win:show() in QuickRT, try to enter the following command : ui.update(100000) this will permit to move/resize the window without hanging the Window, but QuickRT will wait.

CraneStyle commented 1 year ago

I know I am not the best coder in the world, but in theory then when I write a windows app with this, i would link ui.update() into the tick ? So that it would get hit during the cycle ?

I am assuming that ui.update() is setting a timer that allows the Ui. TO update for that period of time, but it yields at that point in code ?

On Sun, Apr 23, 2023 at 11:30 AM Tine Samir @.***> wrote:

Hi CraneStyle,

Thank you for the report.

The fact that the just created Window don't respond to the user is expected (user interaction is managed through the ui.update() method call), but it shouldn't crash (I have test it right now and it doesn't crash on my side).

Once you called win:show() in QuickRT, try to enter the following command : ui.update(100000) this will permit to move/resize the window without hanging the Window, but QuickRT will wait.

— Reply to this email directly, view it on GitHub https://github.com/samyeyo/LuaRT/issues/72#issuecomment-1519093634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKJQPUYUIC477DOR5ITPOTXCVDK7ANCNFSM6AAAAAAXIR5CPE . You are receiving this because you authored the thread.Message ID: @.***>

samyeyo commented 1 year ago

I know I am not the best coder in the world, but in theory then when I write a windows app with this, i would link ui.update() into the tick ? So that it would get hit during the cycle ?

Yes you are right, but QuickRT don't provide a "tick" to call ui.update() regularly... but it's a good idea 💡

I am assuming that ui.update() is setting a timer that allows the Ui. TO update for that period of time, but it yields at that point in code ?

Yes, after the time provided in ui.update() call, the execution come back to your Lua script (or to QuickRT in this case)

CraneStyle commented 1 year ago

Any chance you could post a small tutorial on using the studio provided to create a persistent window and like a basic list or something? Just something thats like super basic that would cover making a super basic app like Adding a name to list, would be AWESOME!

At the moment I have no idea how I would, in the studio, do that. Also, I attempted just to make the variation of the quick RT example of hte window using STUDIO and got it to run when i hit the play, but when I tried turning it into an executable and then run, the executable fails saying it cant find a .dll or something I am somewhat confused by it.

On Sun, Apr 23, 2023 at 1:40 PM Tine Samir @.***> wrote:

I know I am not the best coder in the world, but in theory then when I write a windows app with this, i would link ui.update() into the tick ? So that it would get hit during the cycle ?

Yes you are right, but QuickRT don't provide a "tick" to call ui.update() regularly... but it's a good idea 💡

I am assuming that ui.update() is setting a timer that allows the Ui. TO update for that period of time, but it yields at that point in code ?

Yes, after the time provided in ui.update() call, the execution come back to your Lua script (or to QuickRT in this case)

— Reply to this email directly, view it on GitHub https://github.com/samyeyo/LuaRT/issues/72#issuecomment-1519118323, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKJQPUKLDFNLSBPHCO4PWDXCVSPFANCNFSM6AAAAAAXIR5CPE . You are receiving this because you authored the thread.Message ID: @.***>

samyeyo commented 1 year ago

Any chance you could post a small tutorial on using the studio provided to create a persistent window and like a basic list or something?

Yes it's on my todo list !

when I tried turning it into an executable and then run, the executable fails saying it cant find a .dll or something I am somewhat confused by it.

Generated executables depends on the Lua runtime lua54.dll to be executed. Just put a copy of this file (found in the \bin folder) to where you have your compiled executable.

samyeyo commented 1 year ago

Update :

I have an internal working version of QuickRT that calls ui.update periodicaly, refreshing the GUI while creating, resizing, (...) widgets interactively from QuickRT.

Thank your for your feedback that leads me too this good idea 👍

CraneStyle commented 1 year ago

Awesome!

If I see anything else or get an example I think is worth anything ill pipe it your way.

In your opinion, and use so far. Do you ha e any suggestions for project organization ?

With lua, I am used to a single script initializer, and running everything else from modules.

And treating modules as class constructors / managers or pure function libs.

Do you have a preferred or optimal organization?

Without just uploading code, do you have maybe pictures of how you would organize a more complex application?

Finally, are there any best practices you would recommend?

Also, I looked everywhere. Is there a way to load a window within a window? Or do you have to have 2 windows communication with each other for that kind of feature.

I was looking through Microsoft documentation, but it didn't really give me any clues.

On Tue, May 2, 2023, 2:17 PM Tine Samir @.***> wrote:

Update :

I have an internal working version of QuickRT that calls ui.update periodicaly, refreshing the GUI while creating, resizing, ... widgets interactively from QuickRT.

Thank your for your feedback that leads me too this good idea 👍

— Reply to this email directly, view it on GitHub https://github.com/samyeyo/LuaRT/issues/72#issuecomment-1531936412, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJKJQPV3DDM4WERAVFPLOELXEFFTHANCNFSM6AAAAAAXIR5CPE . You are receiving this because you authored the thread.Message ID: @.***>

samyeyo commented 1 year ago

In your opinion, and use so far. Do you ha e any suggestions for project organization ? With lua, I am used to a single script initializer, and running everything else from modules. And treating modules as class constructors / managers or pure function libs. Do you have a preferred or optimal organization?

It depends of the project, but usually I'll keep with one script regrouping objects/functions that have the same goal. I tend to use submodules folder hierarchy when the application is complex.

Also, I looked everywhere. Is there a way to load a window within a window? Or do you have to have 2 windows communication with each other for that kind of feature.

LuaRT don't support Window in other windows, but it's good idea. If I have time I will check what I can do