Jump to content

My button won't work


namedrisk
 Share

Recommended Posts

Hi,

I am trying to make my UPDATE button work but it won't when i click it, but if i set the List directly it will work just fine...

here is the code i am using to test:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <ComboConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>

$wName = 'xXx'

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Update Test", 306, 346, 196, 118, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
$Menu = GUICtrlCreateTab(0, 0, 305, 345)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Waypoint = GUICtrlCreateTabItem("Waypoint")
$WaypointSelList = GUICtrlCreateGroup("Select Waypoint Profile", 8, 33, 289, 113)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$WaypointListSelection = GUICtrlCreateLabel("Select a waypoint:", 16, 57, 94, 18)
$WaypointCombo = GUICtrlCreateCombo("", 16, 81, 145, 25, $CBS_DROPDOWNLIST)
$WaypointBtnOk = GUICtrlCreateButton("OK", 16, 113, 51, 25)
$WaypointBtnUpdate = GUICtrlCreateButton("UPDATE", 80, 113, 56, 25)
GUICtrlSetOnEvent($WaypointBtnUpdate, "ListWaypoint")
GUICtrlCreateTabItem("")
#EndRegion ### END Koda GUI section ###

GuiSetState()

Do
Until GuiGetMsg() = $GUI_EVENT_CLOSE

Func ListWaypoint()
    $WaypointComboUpdate = ''
    $ListWaypoint = IniReadSectionNames("Waypoints.ini")
    For $i = 1 To $ListWaypoint[0]
        If $WaypointComboUpdate = '' Then
            $WaypointComboUpdate = $ListWaypoint[$i]
        Else
            $WaypointComboUpdate = $WaypointComboUpdate&'|'&$ListWaypoint[$i]
        EndIf
    Next
    GUICtrlSetData($WaypointCombo, "") ; Clear previous info to avoid duplicated information on the dropdown list
    GUICtrlSetData($WaypointCombo, $WaypointComboUpdate) ; Update with new content
EndFunc

thanks in advance

Edited by namedrisk
Link to comment
Share on other sites

You can't mix OnEvent- and MessageLoop-mode like that. Open the helpfile, browse to "GUI Reference" and read those 3 pages. It will take a couple of minutes but you will be able to make a basic GUI like that working.

Link to comment
Share on other sites

Add Opt("GUIOnEventMode", 1).

Thanks man that works just fine for me it updates now :D

You can't mix OnEvent- and MessageLoop-mode like that. Open the helpfile, browse to "GUI Reference" and read those 3 pages. It will take a couple of minutes but you will be able to make a basic GUI like that working.

Thanks for the information i am reading it right now indeed it has some good references that i was missing...

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