Jump to content

Recommended Posts

Posted

I'm trying to write a GUI to display my test script posting during test run. I have try to create a function show the GUI. There are also functions to handle message posting, event buttons and progress bar increments in this GUI. However, I notice that I need put a loop at the end of function to keep the GUI on screen. Is there any way to show the GUI and allow it to be control by other functions later? :)

CODE

Func _ProgressForm_Show(ByRef $s_control, $s_location)

;Set GUI Window position on desktop

Switch $s_location

Case "Bottom-Right"

$h_Form_TestProgress = GUICreate("Test Progress", 269, 279, @DesktopWidth - 269, @DesktopHeight - 279 - 30)

Case "Bottom-Left"

$h_Form_TestProgress = GUICreate("Test Progress", 269, 279, 0, @DesktopHeight - 279 - 30)

Case "Top-Right"

$h_Form_TestProgress = GUICreate("Test Progress", 269, 279, @DesktopWidth - 269, 0)

Case "Top-Left"

$h_Form_TestProgress = GUICreate("Test Progress", 269, 279, 0, 0)

Case Else

$s_location = "Unknown"

EndSwitch

;Draw GUI objects in window

$h_Pic_Logo = GUICtrlCreatePic(@ScriptDir & "\Progress.bmp", 0, 0, 270, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$h_Editbox_Posting = GUICtrlCreateEdit("", 0, 89, 270, 235, BitOR($ES_MULTILINE, $ES_READONLY, $WS_VSCROLL))

$h_Progressbar_TestStatus = GUICtrlCreateProgress(6, 64, 240, 19)

$h_Button_Stop = GUICtrlCreateButton("Stop", 144, 240, 89, 33, 0)

GUICtrlSetOnEvent($h_Button_Stop, "_ProgressForm_StopTestButton")

;Show window on screen

GUISetState(@SW_SHOW)

;Return control identifier (controlID) which required changes later

If $s_control = 0 Then

SetError(1)

Return 0

Else

;~ Dim $a_info[3]

$a_info[0] = $s_control ;ControlID

$a_info[1] = $h_Progressbar_TestStatus ;ProgressbarID

$a_info[2] = $h_Editbox_Posting ;EditboxID

;~ Return $a_info

EndIf

;~ ;Endless While loop to keep the GUI Open

;~ While 1

;~ $nMsg = GUIGetMsg()

;~ Switch $nMsg

;~ Case $GUI_EVENT_CLOSE

;~ Exit

;~ EndSwitch

;~ WEnd

EndFunc

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
×
×
  • Create New...