Jump to content

Can someone please explain why


kjactive
 Share

Recommended Posts

I stumbled over a wird thing - actually two strange things that I do not know if this is a bug - can someone please explain my simple script d not get menu returns at all but all other like resize returns...

This is a squized down script to handle three or more window handles, that's why I check up to locate what windowID it came from first ( Case $msg[1] = $MainW ) as all windows got a quit and only the calling window should get quit but the calling window do neigher get the quit but all get messaged in resizeID...

#include <GUIConstants.au3>

Global Const $Prefs = 'HKEY_CURRENT_USER\software\Au3ComDialog\Prefs',$title = 'Menu bug ?',$Rev = '1.0',$auther = ' (c)2005 by Kåre Johansson'; init constants
Global $MainW,$dm0,$Status1C,$Status2C; init main intuition variables
Global $QuitM; init menu globals
ReadPrefs($Prefs); readin the preferences
MainWindow()

While 1
   $msg = GUIGetMsg(1)
   Select
    Case $msg[1] = $MainW
        Select
        Case $msg[0] = $GUI_EVENT_RESIZED
            ConsoleWrite(1 & @CRLF)
        Case $msg[0] = $GUI_EVENT_CLOSE OR $msg[0] = $QuitM
            ConsoleWrite(2 & @CRLF)
            ExitLoop
        EndSelect
    EndSelect
Wend
Exit

;==================================================================
;MainWindow: Open the Formwindow intuition
;argument no / return no
;==================================================================
Func MainWindow()
$MainW = GUICreate($title & ' ' & $rev & ' ' & $auther, $dm0[3], $dm0[4], $dm0[1], $dm0[2],BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS))
$ProjectM = GUICtrlCreateMenu ("Project")
$QuitM = GUICtrlCreateMenuitem ("Quit",$ProjectM)

$Status1C = GUICtrlCreateInput('',0,$dm0[4]-40,150,20,$ES_READONLY)
$Status2C = GUICtrlCreateInput('',150,$dm0[4]-40,$dm0[3]-150,20,$ES_READONLY)
EndFunc

;==================================================================
;ReadPrefs: read in the preferences from initbase
;argument: the initbase address, no returns
;==================================================================
Func ReadPrefs($Prefs)
$var = RegRead($Prefs, 'FormWindow')
If @error Then $var = '0 0 640 480';MainW: x y w h
$dm0 = StringSplit($var,' ')
EndFunc

The other thing is that there is no GUISetState() function to the main window and normally that leaves the window unvisualized but this window show up nicely - Why me or bug...

Could someone please explain why this behave to my scrip, is this a bug or what...

kjactive B)

Edited by kjactive
Link to comment
Share on other sites

  • Moderators

Hey kj... Did you try this?

Func MainWindow()
$MainW = GUICreate($title & ' ' & $rev & ' ' & $auther, $dm0[3], $dm0[4], $dm0[1], $dm0[2],BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS))
$ProjectM = GUICtrlCreateMenu ("Project")
$QuitM = GUICtrlCreateMenuitem ("Quit",$ProjectM)

$Status1C = GUICtrlCreateInput('',0,$dm0[4]-40,150,20,$ES_READONLY)
$Status2C = GUICtrlCreateInput('',150,$dm0[4]-40,$dm0[3]-150,20,$ES_READONLY)
GUISetState(@SW_SHOW)
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@kjactive

If you think it is a bug, then you should mention your AutoIt version. Especially if you have posted a bug report. I notice you are using StringSplit without checking the @error macro. The last couple of beta versions have had troubles with StringSplit, so it would be good to know if you using 3.1.1.88 ? Beta is always a risk and unknown so you need to be more specific with beta problems. We can only answer to what we know and what version of AutoIt we/you are using.

Link to comment
Share on other sites

Well yes - I always use latest beta revision...

Hey kj... Did you try this?

Yes and that fixes the trouble but the thing is 'written in documentation' and it used to be - that the window should not be visioniced before 'GUISetState()' but it does, is this not a bug or somehow me...

kjactive B)

Link to comment
Share on other sites

Well yes - I always use latest beta revision...

Yes and that fixes the trouble but the thing is 'written in documentation' and it used to be - that the window should not be visioniced before 'GUISetState()' but it does, is this not a bug or somehow me...

kjactive B)

How Autoit can fight to your desire $WS_VISIBLE use at creation time

Just don't use it if you want to manage the popup with the GUISetState.

I have to admit that the not displaying of control can be improved. :o

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...