Jump to content

What are *classic* causes for basic GUI stuff not to work?


Guy_
 Share

Recommended Posts

I consider myself an advanced newbie (still) and made several GUI dialogs and Listboxes working fine, but currently I've walked into basic things that for some reason are not working or crashing AutoIt. Are there some *classic* things/errors I can watch for...? (Win 7; AutoIt still 3.3.14.1)

(1)  In this almost textbook example, the window appears but after a few seconds the program hangs for some reason...

Local $hEditor = GUICreate("Bookmark Editor", 400, 400)

            GUISetState(@SW_SHOW, $hEditor)

            While 1

                Switch GUIGetMsg()

                    Case $GUI_EVENT_CLOSE
                        ExitLoop

                EndSwitch
            WEnd

            GUIDelete($hEditor)

https://i.imgur.com/dW6BapU.jpg

(2) For a Listbox in my program, I've experimented with the commands to change font size, but they never do anything... I've experimented putting these commands in different places (and with the correct controlID)

GUISetFont(12)  ;  no effect
nor
GUICtrlSetFont ( controlID, 12 )

TIA :)

Link to comment
Share on other sites

  • Developers

The posted script can't be the whole thing causing the "hang" as it doesn't run without #includes.
What about you post the code that you tested the issue with and causes the "hang"? ;) 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

12 minutes ago, Jos said:

What about you post the code that you tested the issue with and causes the "hang"? ;)

The file is 15000 lines, which is why I'm asking if someone is aware of some CLASSIC causes... :)

It seemed to me this should almost always simply work...

(2) is (not) happening in the same Func though, so I might test that in another part, which may give me a clue that the problem is in the original Func somehow...

Link to comment
Share on other sites

The Func it's happening in is called from my Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

Could it be that this WM_COMMAND wants my Func to return ASAP and therefore things hang? (doesn't allow pause for a dialog?)

(I know this is the case for some things)

Link to comment
Share on other sites

You can't put dialogs inside a message handler, it actually says that in the help file if you'd have read it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

8 minutes ago, BrewManNH said:

You can't put dialogs inside a message handler, it actually says that in the help file if you'd have read it.

"As a newbie" I'm calling a Func from there and thus keeping the code short inside the handler, but I guess technically it's the same thing...

Is it then impossible to, in my case, go into a dialog by clicking a Listbox item?

I know I can solve this in another way, but it's not as direct...

Edited by Guy_
Link to comment
Share on other sites

  • Developers
58 minutes ago, Guy_ said:

The Func it's happening in is called from my Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

Could it be that this WM_COMMAND wants my Func to return ASAP and therefore things hang? (doesn't allow pause for a dialog?)

(I know this is the case for some things)

So why post that code as there is no relation at all to the issue?
This simply happens when you aren't processing the GUI's generated messages anymore by GuiGetMsg(), so figure out why that is happening and you are in business again.

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

13 minutes ago, Jos said:

So why post that code as there is no relation at all to the issue?

To prove I have the basics right. If I can't post 15000 lines, isn't it better if I give you *something*?

Also, I didn't remember I called it from WM_COMMAND until after I posted (as usually happens).

I work on things off and on and I don't have a photographic memory... In the end I *did* remember the right clue, I hope.

I'm not sure what you mean... I Alt-clicked a Listbox item and I want to be able to edit things for that item.

I guess I'll make an independant Func for it, until I get it, or people have a better day here... ;)

I try not to ask questions and I have ony 130 posts in 15 years... Harldy overtaxing anyone, IMO -- yet for some reason I get 2 smartass "RTFM" style replies...

Edited by Guy_
Link to comment
Share on other sites

  • Developers
12 minutes ago, Guy_ said:

I try not to ask questions and I have ony 130 posts in 15 years... Harldy overtaxing anyone, IMO -- yet for some reason I get 2 smartass "RTFM" style replies...

Hey, no worries, it was just confusing as it felt like that simply piece of code gave you the "hanging GUI" issue, which is pretty impossible. ;) 

11 minutes ago, Guy_ said:

I'm not sure what you mean...

This is about my second comment? I was just explaining when the "hanging gui" issue occurs.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

15 hours ago, Guy_ said:

The file is 15000 lines, which is why I'm asking if someone is aware of some CLASSIC causes.

This whole approach is wrong, IMHO, as you're fumbling in the dark for invisible dragons that may not even exist.;) You need to start by stripping down your code to the smallest-possible script (no more than a few dozen, or at worst, a few hundred lines) that reproduces your issue. That makes it much easier (for us and for you) to figure out what's going (wr)on(g), and to test and tinker with various alternatives.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...