Jump to content

TeddyTech

Members
  • Posts

    6
  • Joined

  • Last visited

TeddyTech's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks ... the VarGetType really helped make more sense out of this behavior. I've changed that original to $rl = Int(StringLeft($range,4)) and all is well.
  2. I was trying to write a routine that moved through a decimal range and gave me the difference in hex. The difference would be correct in decimal, but when I tried to convert it to hex it always returned zero. After struggling with this for a while thinking I was doing something wrong I finally broke out the code I was struggling with and built this small test. It does not behave like I expect. Is this a bug or is it working-as-designed and I just don't understand some nuance of "string" numeric vs. "real" numeric? Teddy $range = "2010-2023" $rl = StringLeft($range, 4) $rr = StringRight($range, 4) ConsoleWrite("Diff (without hex()) =" & ($rr - $rl) & @CRLF) ;Diff (without hex()) =13 ConsoleWrite("Hex without Number() =" & Hex($rr - $rl, 2) & @CRLF) ;Hex without Number() =00 ConsoleWrite("Hex with Number() on sum =" & Hex(Number($rr - $rl), 2) & @CRLF) ;Hex with Number() on sum =00 <-- this one is really confusing ConsoleWrite("Hex with Number() on each =" & Hex(Number($rr) - Number($rl), 2) & @CRLF) ;Hex with Number() on each =0D
  3. Melba23, Thanks for the quick ... and perfect ... answer! I actually played with the parameters on _GUICtrlMenu_TrackPopupMenu() , but I must have made a mistake because it did not resolve my problem. Thanks again, TeddyTech (In case you are interested -- I'm building a toolbar application that allows me to place 1-12 windows on top of each other and toggle through them using buttons on the toolbar. The individual windows are opened on their own and this context menu is going to allow the user to select "Add" to create a button on the toolbar and add the window to the stack.)
  4. I have a problem with a context menu. When I right click on the form the context menu opens and responds properly. (This code is based on the help file sample.) However, when I right click on a button the context menu opens but it does not respond. Ideally, I would like to have the context menu respond properly whenever it is opened. If that is not possible, then I want to keep the context menu from opening when right-clicking over a button. (I have searched the forums and the help files, but cannot figure this one out.) (And, as an aside, why does posting my code using the "AutoIt Code" option strip out the #include file names?) Thanks! Here is a stripped-down test version of my code: #include <GuiMenu.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Enum $idOpen = 1000, $idSave, $idInfo _Main() Func _Main() ; Create GUI GUICreate("Menu", 400, 300) GUICtrlCreateButton("LCDAMVS", 0,0) GUISetState() ; Register message handlers GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Handle WM_COMMAND messages Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Switch $iwParam Case $idOpen _WinAPI_ShowMsg("Open") Case $idSave _WinAPI_ShowMsg("Save") Case $idInfo _WinAPI_ShowMsg("Info") EndSwitch EndFunc ;==>WM_COMMAND ; Handle WM_CONTEXTMENU messages Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, $iwParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True EndFunc ;==>WM_CONTEXTMENU
  5. Melba23, Duh! I've been using AutoIT a lot for several years, but never much with the GUI. I looked all over the help files, but missed that little tidbit. And I will definitely look at the wiki. I would really like to be able to make the window movable without having to put a title bar on it and it sounds like that page may tell me how. Thanks again for the accurate ... and quick ... assistance. Teddy
  6. I'm simply trying to toggle a form title bar and frame off and on. If I click on the label on the form I can turn everything off, but I cannot seem to figure out how to toggle it back on. (This is for a temperature monitoring window that I want to show just the temperature value in a large font with no frame, but have the ability to turn on the title bar to make it easy to position the window.) Here's a simple example of what my code so far: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Toggle=True Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 120, 150, 192, 114,$WS_SYSMENU) $Label1 = GUICtrlCreateLabel("Click Here to toggle header", 0, 0) GUICtrlSetOnEvent(-1, "LabelPressed") GUISetState(@SW_SHOW) While 1 Sleep(500) WEnd Exit Func LabelPressed() If $Toggle Then GUISetStyle($WS_POPUPWINDOW) GUICtrlSetData($Form1, 'Undo Style') $Toggle = NOT $Toggle Else GUISetStyle($WS_SYSMENU) GUICtrlSetData($Form1, 'Set Style') $Toggle = NOT $Toggle EndIf EndFunc Thanks for any help. Teddy
×
×
  • Create New...