dabus Posted March 24, 2006 Share Posted March 24, 2006 I want to write a simple launcher to emulate apwal ( a nice and neat thing if you do not want to clutter your desktop.-- and have a gnu-system like linux, freebsd, ... ) It will read an inifile to see where you wanted commands/icons to be placed. If you press e, it will show you unused 'places' where you could place more commands. If you press the left or right mousebutton, it will write the $Index-number of the Item to console and add a menu to that item. (I asked that one some while ago, thanks again to gafrost ) The problem I have is that I can't see the menu (I already tried to paint it or use Show). It seems to appear only if I delete the transparent background (uncomment the line in Edit-func). Is there a workaround for this problem? (Adding another gui-window would solve that, but I'm not sure if that's the right solution.) expandcollapse popup; Based on System32-Icons from YDY (Lazycat) ; alpha state, needs autoit-beta #include <GUIConstants.au3> #include <Misc.au3> AutoItSetOption("TrayIconDebug", 1) HotKeySet ( 'e' , 'Edit' ) ; Setting variables Global $Num=6, $Icons[$Num*$Num], $IconSize=48, $IconVSize=60, $IniFile=@ScriptDir & '\DApwal.ini' Global $StartIndex = 0, $Row, $Col, $Index $Start=TimerStart() $dll = DllOpen("user32.dll") ; Creating GUI GUICreate("DApwal", 450, 450, (@DesktopWidth-450)/2, (@DesktopHeight-450)/2, $WS_POPUP,$WS_EX_LAYERED); $WS_EX_ACCEPTFILES ; Create defined icons $BG=GUICtrlCreatePic(@ScriptDir & "\AllTrans.gif",0,0,450,450) For $Row = 0 To $Num-1 For $Col = 0 To $Num-1 $Index = $Row * $Num + $Col $Command=IniRead ( $IniFile, $Index, 'Command', '' ) If $Command <> '' Then $Pic=IniRead ( $IniFile, $Index, 'Picture', '' ) $Icons[$Index] = GUICtrlCreatePic($Pic, $IconVSize * $Col, $IconVSize * $Row, $IconSize, $IconSize ) ; Else ; $Icons[$Index] = GUICtrlCreatePic('', $IconVSize * $Col, $IconVSize * $Row, $IconSize, $IconSize ) EndIf Next Next GUISetState() $Diff=TimerDiff ( $Start ) ConsoleWrite('@@ Debug(41) : $Diff = ' & $Diff & @lf & '>Error code: ' & @error & @lf);### Debug Console While 1 $Msg = GUIGetMsg(1) $mPos = MouseGetPos() $wPos = WinGetPos("DApwal") ToolTip($mPos[0] - $wPos[0] & " / " & $mPos[1] - $wPos[1]) If _IsPressed (01, $dll) Or _IsPressed (02, $dll) Then $mPos = MouseGetPos() $xCounter = 0 $yCounter = 0 While 1 If $xCounter = $Num-1 Then ExitLoop If ($mPos[0] - $wPos[0]) - (($xCounter + 1) * $IconVSize) >= 0 Then $xCounter = $xCounter + 1 Else ExitLoop EndIf WEnd While 1 If $yCounter = $Num-1 Then ExitLoop If ($mPos[1] - $wPos[1]) - (($yCounter + 1) * $IconVSize) >= 0 Then $yCounter = $yCounter + 1 Else ExitLoop EndIf WEnd ConsoleWrite($yCounter * $Num + $xCounter & @CR) $Menu = GUICtrlCreateContextMenu($Icons[$yCounter * $Num + $xCounter]) ConsoleWrite ( $Menu & @CR ) $Name = GUICtrlCreateMenuItem($yCounter * $Num + $xCounter, $Menu) $Delete = GUICtrlCreateMenuItem("Delete", $Menu) $Rename = GUICtrlCreateMenuItem("Rename", $Menu) $Open = GUICtrlCreateMenuItem("Open", $Menu) GUICtrlSetBkColor($Menu,0x00ff00) ; Green Sleep(250) ElseIf $Msg[0] = $GUI_EVENT_CLOSE Then DllClose($dll) Exit EndIf WEnd ; List unused "slots" Func Edit () GUISetState ( @SW_HIDE ) ; GUICtrlDelete ( $BG ) For $Row = 0 To $Num-1 For $Col = 0 To $Num-1 $Index = $Row * $Num + $Col $Command=IniRead ( $IniFile, $Index, 'Command', '' ) If $Command = '' Then $Icons[$Index]=GUICtrlCreatePic(ScriptDIr & '\question.gif', $IconVSize * $Col, $IconVSize * $Row, $IconSize, $IconSize ) EndIf Next Next GUISetState ( @SW_SHOW ) EndFunc Link to comment Share on other sites More sharing options...
dabus Posted March 25, 2006 Author Share Posted March 25, 2006 (edited) I think I just missed the last 0 :"> $BG=GUICtrlCreatePic(@ScriptDir & "\AllTrans.gif",0,0,450,450, 0)[Advertisement]Look here if you want to see the modified code...http://www.autoitscript.com/forum/index.php?showtopic=23693[/Advertisement] Edited March 25, 2006 by dabus Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now