Liberty BASIC Community Forum
« Disable dialog window crashes LB 4.04 »

Welcome Guest. Please Login or Register.
Nov 22nd, 2017, 01:34am


Rules|Home|Help|Search|Recent Posts|Notification

Problems installing Liberty BASIC? Read the Vista/Win7 Installation FAQ
Looking for a categorized List of Bug Reports? Visit the Liberty BASIC Bug Tracker

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Disable dialog window crashes LB 4.04  (Read 791 times)
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Disable dialog window crashes LB 4.04
« Thread started on: Jul 28th, 2016, 3:56pm »

Can somebody confirm that trying to disable a dialog window in LB causes it to crash? I can only test in 4.04 Pro. I get "is empty is not understood". Using windows 7.

Code:
' demonstrates that trying to disable dialog type window crashes LB 4.04

nomainwin

open "window 1" for dialog_nf as #w1
'open "window 1" for window_nf as #w1

button #w2, "exit", [quit], UL,  15, 15, 150,  70
open "window 2" for dialog_nf as #w2

' possible crash here
print #w1, "disable"

wait


[quit]

print #w1, "enable"

close #w1
close #w2

end
 
« Last Edit: Jul 28th, 2016, 4:03pm by hooshnik » User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 626
xx Re: Disable dialog window crashes LB 4.04
« Reply #1 on: Jul 28th, 2016, 6:10pm »

Yes, the same on 4.5.0 and Win7. It doesn't understand the command.
I'm thinking on an idea I have to do something with all these error.log messages. A code helper, open source.
User IP Logged

cundo
Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2285
xx Re: Disable dialog window crashes LB 4.04
« Reply #2 on: Jul 28th, 2016, 9:34pm »

I'm seeing the same issue, and I agree with cundo; I don't think dialog windows support the DISABLE command.


I don't know if this is a glitch/oversight, or intentional, but this fact doesn't appear to be documented at first glance(only did a quick check of the helpfile).


I can understand why it might not support being disabled(as a general-purpose window isn't the use case of a dialog window; it's supposed to be a temporary window for displaying or retrieving information from the user, in a way that interrupts the standard UI.), but it'd be nice to know if that's the actual reason.
User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5567
xx Re: Disable dialog window crashes LB 4.04
« Reply #3 on: Jul 29th, 2016, 04:41am »

A dialog window stops all processing and takes command of all input till it is closed. It would be inappropriate to disable/enable it. So it is intentional.
User IP Logged

hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: Disable dialog window crashes LB 4.04
« Reply #4 on: Jul 29th, 2016, 1:40pm »

on Jul 29th, 2016, 04:41am, Rod wrote:
A dialog window stops all processing and takes command of all input till it is closed.


In theory but not in practice in LB. They are not like modal windows which I detest as I can't pick and choose which windows I want disabled. I am afraid a non-admin user will just let it fall in the background layer and forget about it because they are too "busy".

User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 626
xx Re: Disable dialog window crashes LB 4.04
« Reply #5 on: Jul 29th, 2016, 1:52pm »

I sometimes "disable" the window in the background, then I "enable" it again when closing the dialog ontop.
User IP Logged

cundo
Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2285
xx Re: Disable dialog window crashes LB 4.04
« Reply #6 on: Jul 29th, 2016, 7:33pm »

on Jul 29th, 2016, 1:40pm, hooshnik wrote:
In theory but not in practice in LB. They are not like modal windows which I detest as I can't pick and choose which windows I want disabled. I am afraid a non-admin user will just let it fall in the background layer and forget about it because they are too "busy".



"Can't pick and choose which windows to disable"? What do you mean?

You should have control over all regular windows and controls in your program, and can enable and disable them at will.

Unless you mean, that's why you don't use dialog_modal.


In that case, why is a dialog window even being used in the first place? Do you have nested popups to show the user? Or are you treating it like an ordinary window?


And the reason I said that about dialog windows is that that is their intended use in the Win32 subsystem, and Windows can, in fact, treat them differently than standard windows.


I'm willing to agree this is a bug in LB; at the very least, I don't think it should crash like this, or perhaps it should have a more specific error message, since it's a specific condition. However, I'm still not sure how this dialog window is being used.
« Last Edit: Jul 29th, 2016, 7:35pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: Disable dialog window crashes LB 4.04
« Reply #7 on: Jul 30th, 2016, 6:09pm »


on Jul 29th, 2016, 7:33pm, Chris Iverson wrote:
"Can't pick and choose which windows to disable"? What do you mean?

You should have control over all regular windows and controls in your program, and can enable and disable them at will.

Unless you mean, that's why you don't use dialog_modal.


In that case, why is a dialog window even being used in the first place? Do you have nested popups to show the user? Or are you treating it like an ordinary window?


It is complicated because I have to track about 20 different windows. Modal only disabled the parent for me which is useless for my case.

Suppose a user gets a dialog window as a child of window1. Then they go to window2 and create another child dialog there. There are then 2 dialog windows open and the second one might depend on the first dialog window (the 2 parent windows are tightly integrated with each other). Now I could program for every possible stupid thing the user might think of doing and cause a bug that's very difficult for me to find or I could simply disable all other windows in the program until they answered the question in the first dialog window. That is the logic behind this. I am trying to save myself some trouble because in my company our testing is poor.

The reason I was considering this is to get around the poor high DPI support in LB by making all windows of type dialog but as I found out that is its own disaster so I think I'll just have to code around all of these problems and hope for the best. Regex anybody?
« Last Edit: Jul 30th, 2016, 6:09pm by hooshnik » User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2285
xx Re: Disable dialog window crashes LB 4.04
« Reply #8 on: Jul 30th, 2016, 10:31pm »

Ouch. That makes a lot more sense, and you very much have my sympathies.

I've been digging through MSDN to see if there's an easier way to accomplish this, but everything I come up with boils down to a variation of just handling it manually.

That said, I may be able to offer something that will at least let you use dialog boxes for DPI issues: Use the EnableWindow() API call, instead of LB's missing built-in command.

Code:
open "blah" for dialog as #test3
input a

call DisableWindow "#test3"
input a

call EnableWindow "#test3"
input a

close #test3

end

Sub EnableWindow hndl$
    EnableWindow = Win32EnableWindow(hWnd(#hndl$), 1)
End Sub

Sub DisableWindow hndl$
    DisableWindow = Win32EnableWindow(hWnd(#hndl$), 0)
End Sub

Function Win32EnableWindow(hWnd, bEnabled)
    CallDLL #user32, "EnableWindow",_
    hWnd as ulong,_
    bEnabled as long,_
    Win32EnableWindow as long
End Function 
« Last Edit: Jul 30th, 2016, 10:39pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: Disable dialog window crashes LB 4.04
« Reply #9 on: Aug 1st, 2016, 1:34pm »

Thanks Chris.

So here's what it boils down to (I forgot about this before). I ended up using window definition sections inside functions to try to make my life easier. Why? Cause if I do that I don't have to have goto [returningBranchLabel] all over the place for a window that can be called from many locations (example: the network connection for the backup is down). The problem is (I found out after) that because of a limitation of scope in "functionized" windows you can't have the user clicking on any other window button and causing a branching event or IT'S GAME OVER. You get invalid branch label and the instruction pointer for the program goes wacko and you can't regain control. I would actually file this as a bug too for LB. Is that considered a bug? So then that leaves me with no choice but to disable all other windows.
User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
cundo
Guru
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 626
xx Re: Disable dialog window crashes LB 4.04
« Reply #10 on: Aug 1st, 2016, 2:53pm »

I don't know if it is a bug, actually Branch labels are local in scope (is that the correct name?). If you have Buttons you may want to use Subs instead of Branches. Everything contained in Subs and Functions.
User IP Logged

cundo
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5567
xx Re: Disable dialog window crashes LB 4.04
« Reply #11 on: Aug 1st, 2016, 2:53pm »

It has to be said, stop using twenty windows. User input is always a challenge. Controls can be hidden, moved and disabled or greyed out to push the user in the right direction.

But I don't know what the task is so its just a guess. But twenty windows feels like hard work, not a criticism, it's just something I would never have contemplated coding.
User IP Logged

hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: Disable dialog window crashes LB 4.04
« Reply #12 on: Aug 1st, 2016, 3:09pm »

on Aug 1st, 2016, 2:53pm, cundo wrote:
I don't know if it is a bug, actually Branch labels are local in scope (is that the correct name?). If you have Buttons you may want to use Subs instead of Branches. Everything contained in Subs and Functions.


I already do that. It still doesn't matter.

EDIT: oh. You mean all or nothing for the entire program? What about all gotos? Do we have to eliminate that too? I wish I had been warned about the caveats of using functionized windows before I started using them.
« Last Edit: Aug 1st, 2016, 3:15pm by hooshnik » User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
CarlGundel
Administrator
ImageImageImageImageImage


member is offline

Avatar

author of Liberty BASIC


Homepage PM


Posts: 2833
xx Re: Disable dialog window crashes LB 4.04
« Reply #13 on: Aug 1st, 2016, 4:44pm »

on Jul 28th, 2016, 9:34pm, Chris Iverson wrote:
I'm seeing the same issue, and I agree with cundo; I don't think dialog windows support the DISABLE command.


I don't know if this is a glitch/oversight, or intentional, but this fact doesn't appear to be documented at first glance(only did a quick check of the helpfile).


I can understand why it might not support being disabled(as a general-purpose window isn't the use case of a dialog window; it's supposed to be a temporary window for displaying or retrieving information from the user, in a way that interrupts the standard UI.), but it'd be nice to know if that's the actual reason.


I think you've nailed it Chris. I'll have to think about this. It may be possible to disable the entire window, but I'm not going to commit to it right off.

-Carl
User IP Logged

author of Liberty BASIC
http://www.libertybasic.com
Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2285
xx Re: Disable dialog window crashes LB 4.04
« Reply #14 on: Aug 1st, 2016, 7:43pm »

on Aug 1st, 2016, 3:09pm, hooshnik wrote:
I already do that. It still doesn't matter.

EDIT: oh. You mean all or nothing for the entire program? What about all gotos? Do we have to eliminate that too? I wish I had been warned about the caveats of using functionized windows before I started using them.


Will GOSUBs work how you need them to? They have the same call/return style of a sub or a function, but they're a normal branch label, and don't change scope when called.

Upon executing the RETURN at the end of a GOSUB target, execution will resume at the point the GOSUB was executed.



To answer your question, you don't have to eliminate goto's, but you will NOT be able to jump to a branch label in a different execution scope. (Global scope vs function/sub scope)
« Last Edit: Aug 1st, 2016, 7:46pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Liberty BASIC Community Wiki
Wikispaces
Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls