Jump to content

PhoenixXL

MVPs
  • Posts

    1,487
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by PhoenixXL

  1. Then the discussion comes to some point I'm having 3.3.10.2 But my syntax checker(also tidy) always crashes whenever it is run through scite upon execution of the script. Upon running the syntax checker explicitly I get the errors you pointed out. I will correct it in the upcoming version (additionally I will reinstall Autoit to clarify the errors) Regards
  2. I'm running scite v3.3.0 but I don't think that's giving the errors.
  3. The following works for me #include <Array.au3> Local Const $String = "1, 2, 3, 4, 5, 1, 2, 3, 4, 5" ConsoleWrite(@AutoItVersion & @CRLF) _ArrayDisplay(StringSplit($String, ", ", 3), "Array Original") _ArrayDisplay(_ArrayUnique(StringSplit($String, ", ", 3), Default, Default, Default, 0), "Array Unique") ; Display the unique array. Console Output: 3.3.10.2 The function definition Func _ArrayUnique(Const ByRef $aArray, $iColumn = Default, $iBase = Default, $iCase = Default, $iFlags = Default) If $iColumn = Default Then $iColumn = 1 If $iBase = Default Then $iBase = 0 If $iCase = Default Then $iCase = 0 If $iFlags = Default Then $iFlags = 1 ; Start bounds checking If UBound($aArray) = 0 Then Return SetError(1, 0, 0) ; Check if array is empty, or not an array ; $iBase can only be 0 or 1, if anything else, return with an error If $iBase < 0 Or $iBase > 1 Or (Not IsInt($iBase)) Then Return SetError(2, 0, 0) If $iCase < 0 Or $iCase > 1 Or (Not IsInt($iCase)) Then Return SetError(2, 0, 0) If $iFlags < 0 Or $iFlags > 1 Or (Not IsInt($iFlags)) Then Return SetError(4, 0, 0) Local $iDims = UBound($aArray, 0), $iNumColumns = UBound($aArray, 2) If $iDims > 2 Then Return SetError(3, 0, 0) ; checks the given dimension is valid If ($iColumn < 1) Or ($iNumColumns = 0 And ($iColumn - 1 > $iNumColumns)) Or ($iNumColumns > 0 And ($iColumn > $iNumColumns)) Then Return SetError(3, 0, 0) ; make $iColumn an array index, note this is ignored for 1D arrays $iColumn -= 1 ; create dictionary Local $oD = ObjCreate("Scripting.Dictionary") ; compare mode for strings ; 0 = binary, which is case sensitive ; 1 = text, which is case insensitive ; this expression forces either 1 or 0 $oD.CompareMode = Number(Not $iCase) Local $vElem ; walk the input array For $i = $iBase To UBound($aArray) - 1 If $iDims = 1 Then ; 1D array $vElem = $aArray[$i] Else ; 2D array $vElem = $aArray[$i][$iColumn] EndIf ; add key to dictionary ; NOTE: accessing the value (.Item property) of a key that doesn't exist creates the key :) ; keys are guaranteed to be unique $oD.Item($vElem) Next ; ; return the array of unique keys If BitAND($iFlags, 1) = 1 Then Local $aTemp = $oD.Keys() _ArrayInsert($aTemp, 0, $oD.Count) Return $aTemp Else Return $oD.Keys() EndIf EndFunc ;==>_ArrayUnique In the helpfile there is no mention of the ByRef type, in the definition though it is. I wonder how it still works for me.
  4. Why not wait for the change and then get the items at one go. This would take the same CPU but only at the time when update occurs, or maybe you can modify it to suit you rather better. The following way to proceed, may help, For a third party app, to monitor messages you would have to use _WinAPI_SetWindowsHookEx with $WH_CALLWNDPROCRET Hook the ListView Monitor message LVM_SETITEM LVM_INSERTITEM Respond to the message, and do your stuff. Example in C++ In the moment I can't try for if it works. Regards Phoenix XL
  5. Use WM_PAINT to draw on the GUI, orelse with your code try to minimize + restore you will find that all the graphics disappear. For your question check the function CheckPointer in the example. Example #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> Global $hGraphic, $hBrush, $hBrushFont, $hFont, $hFormat, $hFamily, $hGUI, $tRect_Coords[4] ;would be used in two functions therefore declared as global. Global $iTheme = 0 Example() Func Example() ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) ; Fill a rectangle _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBrush = _GDIPlus_BrushCreateSolid(0xAA43A6DF) $hBrushFont = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI Light") $hFont = _GDIPlus_FontCreate($hFamily, 20, 2) $tRect_Coords[0] = 10 $tRect_Coords[1] = 10 $tRect_Coords[2] = 100 $tRect_Coords[3] = 100 ;Register for painting GUIRegisterMsg($WM_PAINT, "WM_PAINT") ;$WM_PAINT GUISetState() ; Loop until the user exits. Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN If CheckPointer($tRect_Coords) Then SetTheme(1) Case $GUI_EVENT_PRIMARYUP SetTheme(0) Case $GUI_EVENT_MOUSEMOVE If GetTheme() = 1 Then ContinueLoop If CheckPointer($tRect_Coords) Then SetTheme(2) Else SetTheme(0) EndIf EndSwitch Until 0 ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrushFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) ;Your Code must lie below ;Paint the string _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0) _GDIPlus_GraphicsFillRect($hGraphic, $tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3], $hBrush) _GDIPlus_GraphicsDrawStringEx($hGraphic, "Hello world", $hFont, _GDIPlus_RectFCreate($tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3]), $hFormat, $hBrushFont) ;End of your code _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return 0;'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func CheckPointer(ByRef $aiCoords_ClientRel) Return _WinAPI_PtInRectEx(_WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI), $aiCoords_ClientRel[0], $aiCoords_ClientRel[1], $aiCoords_ClientRel[2] + $aiCoords_ClientRel[0], $aiCoords_ClientRel[3] + $aiCoords_ClientRel[1]) EndFunc ;==>CheckPointer Func GetTheme() Return $iTheme EndFunc ;==>GetTheme Func SetTheme($Theme, $f_Redraw = true) If GetTheme() = $Theme Then Return 1 If $Theme = 0 Then ;Idle _GDIPlus_BrushSetSolidColor($hBrush, 0xAA43A6DF) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Default Dimensions $tRect_Coords[0] = 10 $tRect_Coords[1] = 10 $tRect_Coords[2] = 100 $tRect_Coords[3] = 100 ElseIf $Theme = 1 Then ;MouseDown _GDIPlus_BrushSetSolidColor($hBrush, 0xFF3685B2) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Compress a Bit $tRect_Coords[0] = 12 $tRect_Coords[1] = 12 $tRect_Coords[2] = 96 $tRect_Coords[3] = 96 ElseIf $Theme = 2 Then ;MouseOver _GDIPlus_BrushSetSolidColor($hBrush, 0xBB7BC1E9) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Enlarge a Bit $tRect_Coords[0] = 8 $tRect_Coords[1] = 8 $tRect_Coords[2] = 104 $tRect_Coords[3] = 104 Else Return SetError(1, 0, 0) EndIf $iTheme = $Theme ConsoleWrite("CurTheme: " & $iTheme & @CRLF) If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE)) endfunc ;==>SetTheme Thumbs up if it helped. Regards Phoenix XL
  6. v1.7 released. Changed: Searching with regular expressions. Requires Autoit v3.3.10.2(latest one for the time being). Idub, check the Autoit version you are having.
  7. Don't know exactly but, The >UDF by trancexx will surely make you start
  8. In your case GDIPlus isn't required. The following would also do the same. #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> HotKeySet("{END}", "Terminate") $GUI = GUICreate("", 147, 145, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $pic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0,0,147, 145) GUISetState() Local Const $iTransparency = 50 GUISetBkColor(0xABCDEF) ;this background color should be same as the trans color used in above function _WinAPI_SetLayeredWindowAttributes($GUI,0xABCDEF, $iTransparency) ;~ GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc The precise comparison, can only be given by an expert. I'm still very amateur in it. Regards Phoenix XL
  9. The following would work. Note that Child Windows can't have WS_EX_LAYERED till windows 7, ==> the problem in your first example Note: windows 8 supports WS_EX_LAYERED with child windows. Also WS_EX_TRANSPARENT doesn't allow a window to be transparent, it only allows click through, ie the underlying window would be receiving mouse input but an overlay of the given window would be shown. You can set the transparency of WS_EX_LAYERED windows using functions(check example) Example #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> HotKeySet("{END}", "Terminate") $GUI = GUICreate("", 147, 145, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $pic = GUICtrlCreatePic("", 0,0,147, 145) Local Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() $himg=_GDIPlus_ImageLoadFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif") $hbmp=_GDIPlus_BitmapCreateHBITMAPFromBitmap($himg) _GDIPlus_ImageDispose($himg) _WinAPI_DeleteObject(GUICtrlSendMsg($pic,$STM_SETIMAGE,$IMAGE_BITMAP,$hbmp)) GUISetState() Local Const $iTransparency = 50 GUISetBkColor(0xABCDEF) ;this background color should be same as the trans color used in above function _WinAPI_SetLayeredWindowAttributes($GUI,0xABCDEF, $iTransparency) ;~ GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc Regards Phoenix XL
  10. Didn't knew about that Anyways I'm getting conflicting results, is it the same for all #include <WinAPIShPath.au3> $sTest = "http://testinghg.com/" _U($sTest) $sTest = "http://test/21-04-2014" _U($sTest) Func _U($URL) MsgBox(0, $URL, "URLIs: " & _WinAPI_UrlIs ($sTest) & @CRLF & "IE: " & ((InetGetSize($sTest) = 0) ? "0" : "1")) EndFunc ;==>_U That must be the conflicting results, then. I think, these methods won't solve the problem, we will have to prefer something like on libcURL. InetGetInfo has never given me wrong results(till now at least) therefore I had relied on it. Regards Phoenix XL
  11. Example $sURL = "http://test/21-04-2014" InetGetSize($sURL) If @error Then ConsoleWrite("Invalid URL" & @CRLF) Else ConsoleWrite("Valid URL" & @CRLF) EndIf Regards Phoenix XL
  12. No, I am changing it for the reason that all the items are enumerated at once and if the list of items is very large, then obviously its gonna take some time, and create a lag in the displaying of the list, causing further unpredictable problems that occur when the return of the procedure is not fast. So, I would be probably doing it by, First enumerate the no. of items that will be displayed at once (depends on the height of the suggestion box, and individual item's height) Then enumerate single item further from that index in an elapse of say 10ms until all items are entered. Plus in the second enumeration phase I won't redraw the suggestion, as it would by default be done when the user scrolls down. That would save some of the time. Please put forward, what you all think about it. Regards Phoenix XL
  13. Yup thats it. I somehow missed it
  14. Fixed the two of the bugs (courtesy - Lupo73 and theTony). Check the first post for more information. I was delaying for the reason of finding out a way to make asynchronous finding of the text in the list, so as to populate words efficiently when the size is more than 1000(as posted by ValeryVal). I could find out an appropriate way, but now I'm running out of time to implement it in the UDF. For the time being, I had fixed up the bugs. Regards Phoenix XL
  15. But terenary operator is working from v3.3.10.* Can you give the output of the code MsgBox(0, 0, @AutoItVersion) Regards
  16. @theTony, I will soon fix it with the upcoming version. Thanks for finding it out @Lupo73, Can you provide the code where you get the problem.
  17. Nice idea ValeryVal. I will have to change many parts of code(some async list population - sort of) to make it adaptable with such long lists.
  18. Example #include <Array.au3> #include <GUIConstants.au3> #include <GUICtrlOnHover.au3> #include <WinAPI.au3> #include <SendMessage.au3> Opt( "GuiOnEventMode" , 1 ) ; Colors $sSwatchOutLine = '0x000000' ; Black $sSwatchDisabled = '0xb7b7b7' ; Gray $aSwatchNormal = StringSplit( '0xc7b299|0xf7941d|0xfff200|0x00a651|0x0054a6|0x600080|0xB30086|0xcc1015' , '|' ) $aSwatchHover = StringSplit( '0x998675|0xf26522|0xd8ca03|0x007236|0x003471|0x4D0066|0x990073|0x9e0b0f' , '|' ) $aWeekShort = StringSplit( 'Sun|Mon|Tue|Wen|Thu|Fri|Sat' , '|' ) $aWeekLong = StringSplit( 'Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday' , '|' ) Global $aSwatches[169][2] = [[168]] Global $sSavedSettings = @ScriptDir & "\Scheduler.ini" Global $aSwatchMock[UBound( $aSwatchNormal )][2] = [[UBound( $aSwatchNormal ) - 1]] Global $aWeekLabel[8] = [7] If Not FileExists( $sSavedSettings ) Then _CreateIni() Global $bSettingsScheduler = IniRead( $sSavedSettings , 'Settings' , 'Scheduler' , 'True' ) ; Bool Scheduler Usage $iSwatchCount = 1 $iSwatchSize = 19 $iSwatchArea = $iSwatchSize - 1 $iSwatchMargin = $iSwatchSize + 4 $iFontSize = 9 $iLabelHeight = 17 $iLabelOffset = Round(( $iSwatchSize - $iLabelHeight ) / 2 ) + 1 $iGroupTop = 10 $iGroupLeft = 16 $iGridTop = $iGroupTop + 26 - $iSwatchArea $iGridLeft = $iGroupLeft + 36 - $iSwatchArea $iGroupHeight = ( 26 - $iSwatchArea ) + ( $iSwatchArea * 7 ) + ( $iSwatchMargin * 2 ) + $iSwatchSize + 6 $iGroupWidth = ( 36 - $iSwatchArea ) + ( $iSwatchArea * 24 ) + $iSwatchSize + 20 Global Const $Scheduler = GUICreate( "Scheduler" , $iGroupLeft + $iGroupWidth + 16 , $iGroupTop + $iGroupHeight + 16 , -1 , -1 ) GUISetOnEvent( $GUI_EVENT_CLOSE , "_Quit" ) GUICtrlCreateGroup(" Scheduler Table ", $iGroupLeft , $iGroupTop , $iGroupWidth , $iGroupHeight ) GUICtrlSetFont( -1 , $iFontSize ) ; Rows / Days in Week For $iDay = 1 To 7 $iGridTop += $iSwatchArea $aHours = IniReadSection( $sSavedSettings , $aWeekLong[$iDay] ) $aWeekLabel[$iDay] = GUICtrlCreateLabel( $aWeekShort[$iDay] , $iGroupLeft + 2 , $iGridTop + $iLabelOffset , 30 , $iLabelHeight , $SS_RIGHT ) GUICtrlSetFont( -1 , $iFontSize , 700 ) ; Columns / Hours in Day For $iHour = 1 To 24 $aSwatches[$iSwatchCount][0] = GUICtrlCreateGraphic( $iGridLeft + ( $iHour * $iSwatchArea ) , $iGridTop , $iSwatchSize , $iSwatchSize ) GUICtrlSetOnEvent( $aSwatches[$iSwatchCount][0] , "_SwatchState" ) GUICtrlSetColor( $aSwatches[$iSwatchCount][0] , $sSwatchOutLine ) GUICtrlSetState( $aSwatches[$iSwatchCount][0] , $GUI_ONTOP ) ; Needed if on Tab Control $aSwatches[$iSwatchCount][1] = $aHours[$iHour][1] GUICtrlSetBkColor( $aSwatches[$iSwatchCount][0] , $aSwatchNormal[$aSwatches[$iSwatchCount][1]] ) _GUICtrl_OnHoverRegister( $aSwatches[$iSwatchCount][0] , "_SwatchHover" , "_SwatchLeave" ) $iSwatchCount += 1 Next Next $lbl_ShowDayHour = GUICtrlCreateLabel( "" , $iGridLeft + $iSwatchArea , $iGridTop + $iSwatchMargin + $iLabelOffset , 130 , $iLabelHeight ) GUICtrlSetFont( -1 , $iFontSize ) $chk_Scheduler = GUICtrlCreateCheckbox( "Enable Scheduler" , $iGridLeft + $iSwatchArea , $iGroupHeight - 14 , 115 , $iLabelHeight ) GUICtrlSetFont( -1 , $iFontSize ) GUICtrlSetOnEvent( $chk_Scheduler , "_SchedulerState" ) $iSwatchCount = 1 For $kk = 1 To 2 $iGridTop += $iSwatchMargin $iSwatchOffset = 9 For $ll = 1 To 4 $aSwatchMock[$iSwatchCount][0] = GUICtrlCreateGraphic( $iGridLeft + ( $iSwatchArea * $iSwatchOffset ) , $iGridTop , $iSwatchSize , $iSwatchSize ) GUICtrlSetBkColor( -1 , $aSwatchNormal[$iSwatchCount] ) GUICtrlSetColor( -1 , $sSwatchOutLine ) GUICtrlSetState( -1 , $GUI_ONTOP ) ; Needed if on Tab Control $aSwatchMock[$iSwatchCount][1] = GUICtrlCreateLabel( "State " & $iSwatchCount , $iGridLeft + ( $iSwatchArea * $iSwatchOffset ) + $iSwatchArea + 4 , $iGridTop + $iLabelOffset , 40 , $iLabelHeight ) GUICtrlSetFont( -1 , $iFontSize ) $iSwatchOffset += 4 $iSwatchCount += 1 Next Next GUICtrlCreateGroup("", -99, -99, 1, 1) ; Update Controls If $bSettingsScheduler = 'True' Then GUICtrlSetState( $chk_Scheduler , $GUI_CHECKED ) _SchedulerState() GUISetState( @SW_SHOW ) ; Call the Function Every Minute AdlibRegister( '_CheckScheduler' , 60 * 1000 ) While 1 Sleep( 100 ) WEnd Func _SchedulerState() _SendMessage($Scheduler, $WM_SETREDRAW, False) If _getControlBoolValue( $chk_Scheduler ) Then For $ii = 1 To $aWeekLabel[0] GUICtrlSetState( $aWeekLabel[$ii] , $GUI_ENABLE ) Next For $ii = 1 To $aSwatchMock[0][0] GUICtrlSetState( $aSwatchMock[$ii][1] , $GUI_ENABLE ) GUICtrlSetBkColor( $aSwatchMock[$ii][0] , $aSwatchNormal[$ii] ) Next For $ii = 1 To $aSwatches[0][0] GUICtrlSetState( $aSwatches[$ii][0] , $GUI_ENABLE ) GUICtrlSetBkColor( $aSwatches[$ii][0] , $aSwatchNormal[$aSwatches[$ii][1]] ) Next Else GUICtrlSetData( $lbl_ShowDayHour , '' ) For $ii = 1 To $aWeekLabel[0] GUICtrlSetState( $aWeekLabel[$ii] , $GUI_DISABLE ) Next For $ii = 1 To $aSwatchMock[0][0] GUICtrlSetState( $aSwatchMock[$ii][1] , $GUI_DISABLE ) GUICtrlSetBkColor( $aSwatchMock[$ii][0] , $sSwatchDisabled ) Next For $ii = 1 To $aSwatches[0][0] GUICtrlSetState( $aSwatches[$ii][0] , $GUI_DISABLE ) GUICtrlSetBkColor( $aSwatches[$ii][0] , $sSwatchDisabled ) Next EndIf _SendMessage($Scheduler, $WM_SETREDRAW, True) _WinAPI_RedrawWindow($Scheduler) EndFunc Func _SwatchState() Local $iCurrentSwatch = _ArraySearch( $aSwatches , @GUI_CTRLID , 1 , 0 , 0 , 0 , 1 , 0 ) If $iCurrentSwatch <> -1 Then $aDayHour = _ReturnDayHour( $iCurrentSwatch ) $aSwatches[$iCurrentSwatch][1] = _ToggleBase1ArrayValue( $aSwatches[$iCurrentSwatch][1] , $aSwatchNormal ) GUICtrlSetBkColor( $aSwatches[$iCurrentSwatch][0] , $aSwatchHover[$aSwatches[$iCurrentSwatch][1]] ) IniWrite( $sSavedSettings , $aDayHour[0] , $aDayHour[1] & "_00-" & $aDayHour[1] & "_59" , $aSwatches[$iCurrentSwatch][1] ) EndIf EndFunc Func _SwatchHover( $iSwatchID ) Local $iCurrentSwatch = _ArraySearch( $aSwatches , $iSwatchID , 1 , 0 , 0 , 0 , 1 , 0 ) If $iCurrentSwatch <> -1 Then $aDayHour = _ReturnDayHour( $iCurrentSwatch ) GUICtrlSetData( $lbl_ShowDayHour , $aDayHour[0] & ", " & $aDayHour[1] & ":00 - " & $aDayHour[1] & ":59" ) GUICtrlSetBkColor( $aSwatches[$iCurrentSwatch][0] , $aSwatchHover[$aSwatches[$iCurrentSwatch][1]] ) EndIf EndFunc Func _SwatchLeave( $iSwatchID ) Local $iCurrentSwatch = _ArraySearch( $aSwatches , $iSwatchID , 1 , 0 , 0 , 0 , 1 , 0 ) If $iCurrentSwatch <> -1 Then GUICtrlSetBkColor( $aSwatches[$iCurrentSwatch][0] , $aSwatchNormal[$aSwatches[$iCurrentSwatch][1]] ) EndIf EndFunc Func _ReturnDayHour( $iHour ) Local $aDayHour[2] Switch $iHour Case 1 To 24 $aDayHour[0] = "Sunday" $aDayHour[1] = $iHour - 1 Case 25 To 48 $aDayHour[0] = "Monday" $aDayHour[1] = $iHour - 25 Case 49 To 72 $aDayHour[0] = "Tuesday" $aDayHour[1] = $iHour - 49 Case 73 To 96 $aDayHour[0] = "Wednesday" $aDayHour[1] = $iHour - 73 Case 97 To 120 $aDayHour[0] = "Thursday" $aDayHour[1] = $iHour - 97 Case 121 To 144 $aDayHour[0] = "Friday" $aDayHour[1] = $iHour - 121 Case 145 To 168 $aDayHour[0] = "Saturday" $aDayHour[1] = $iHour - 145 Case Else $aDayHour[0] = "Unknown" $aDayHour[1] = -1 EndSwitch Return $aDayHour EndFunc Func _Quit() IniWrite( $sSavedSettings , 'Settings' , 'Scheduler' , _getControlBoolValue( $chk_Scheduler )) Exit EndFunc Func _CreateIni() Local $sNewIni = '' $sNewIni &= '[Settings]' & @CRLF $sNewIni &= 'Scheduler=True' & @CRLF $sNewIni &= @CRLF For $ii = 1 To $aWeekLong[0] $sNewIni &= '[' & $aWeekLong[$ii] & ']' & @CRLF For $jj = 0 To 23 $sNewIni &= $jj & '_00-' & $jj & '_59=1' & @CRLF Next $sNewIni &= @CRLF Next FileWrite( $sSavedSettings , $sNewIni ) EndFunc Func _ToggleBase1ArrayValue( $iValue , ByRef $aArray ) $iValue += 1 If $iValue >= UBound( $aArray ) Then $iValue = 1 If $iValue <= 0 Then $iValue = 1 Return $iValue EndFunc Func _CheckScheduler() If _getControlBoolValue( $chk_Scheduler ) Then While $aSwatches[(( @WDAY - 1 ) * 24 ) + @HOUR + 1][1] > 1 Local $CurrentValue = $aSwatches[(( @WDAY - 1 ) * 24 ) + @HOUR + 1][1] Local $CurrentHour = @HOUR Switch $CurrentValue Case 2 To 8 MsgBox( 0 , $aWeekLong[@WDAY] , @HOUR & ' is set to ' & $CurrentValue ) EndSwitch While @HOUR = $CurrentHour Sleep( 60 * 1000 ) WEnd WEnd EndIf EndFunc Func _getControlBoolValue( $sControl ) If GUICtrlRead( $sControl ) = 1 Then Return True Else Return False EndIf EndFunc Check these links WM_SETREDRAW RedrawWindow
  19. If you want to just get an static idle icon besides an progress bar, use GuiCtrlCreateIcon and if you want an animated one use _GUICtrlButton_SetImageList Besides, I feel, I could not get exactly what you are asking. Please explain a bit more of what you want to do. Regards
  20. _IECreateEmbedded Should do.
  21. I mean that the highlighting upon click stuff would be only for the active richedit.
  22. Might be of some help. >Link
  23. So, You want that there should be no text append until you click or press enter ? If yes, then replace the following func in the UDF, and you get as you asked ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: _New_WndProc ; Description ...: The New Window Procedure of the Subclassed Edit Control. ; Syntax.........: _New_WndProc($hWnd, $iMsg, $wParam, $lParam) ; Parameters ....: $hWnd - Handle to the window ; $iMsg - Message ID ; $wParam - The first message parameter as hex value ; $lParam - The second message parameter as hex value ; ; Return values .: Passes the Same message to the Original Window Procedure and Returns the Same Value ; Author ........: Phoenix XL ; Modified.......: ; Remarks .......: Called by the Edit Control Internally. If a Password Character is Set to the Edit Control, ; The Window Procedure is automatically set to Original and the Prediction is Unregistered ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _New_WndProc($hWnd, $iMsg, $wParam, $lParam) ; Get the Handle of the Focused Control. Static $i_Ndex Switch $hWnd Case $___cEdit Local $IDFrom = _WinAPI_GetDlgCtrlID($hWnd), $cOffset, $aRet Static $_NewWord, $iSuggest = False Switch $iMsg Case $WM_ADDWORD If StringLen($_NewWord) >= $___Min_Count And $___iNewWords Then Return AddToArray($___nList, $_NewWord) If $wParam = 0 And $lParam = 0 Then Return 1 Case $WM_PREDICTPHRASE If $___SpaceNext Then ;Prediction for Words Containing SPACE Local $_SelText = _GetSelectedText($IDFrom) If StringLeft($_SelText, 1) = ' ' Then $cOffset = _GetCaretOffset($IDFrom) _GUICtrlEdit_ReplaceSel($hWnd, $_SelText) _GUICtrlEdit_SetSel($IDFrom, $cOffset - StringLen($_SelText) + 1, $cOffset) Return -1 EndIf EndIf Return _WinAPI_CallWindowProc($___pOld_WndProc, $hWnd, $WM_CHAR, $wParam, $lParam) Case $WM_PREDICTWORD Return _PredictText($IDFrom) Case $WM_SUGGESTWORD_PROCESS _GUICtrlEdit_ReplaceSel($___cEdit, "", False) $aRet = _GetCurrentWord($IDFrom) If Suggest_PopuplateItems($aRet) = 0 Then If $___SpaceNext Then $aRet = _GetSpaceText($IDFrom) If @error Then ContinueCase Local $nExt = @extended - 1 $aRet = StringMid($___nList[$aRet[0]], 1, $nExt) If Suggest_PopuplateItems($aRet) = 0 Then ContinueCase Else ContinueCase EndIf Else ;User entered an alphabet in between If _GetCurrentWord($IDFrom, _GetCaretOffset($IDFrom) - StringLen($aRet)) <> $aRet Then Return 0 EndIf Suggest_SetPos($___cEdit) If $wParam Then ContinueCase ;only set selection If $iSuggest = False Then $iSuggest = True Suggest_Show() EndIf Return 1 Case $WM_SUGGESTWORD_END If $wParam = 1 Then Local $aString = _GUICtrlListBox_GetText($___hSuggestListWindow, _GUICtrlListBox_GetCurSel($___hSuggestListWindow)) $i_Ndex = StringLen(_GetCurrentWord($IDFrom)) + 1 _SetSelection($IDFrom, $aString, $i_Ndex) EndIf _GUICtrlEdit_SetSel($hWnd, -1, -1) ;Deselect Selection Suggest_Show(0) $iSuggest = False Case $WM_KEYDOWN Switch $wParam Case $VK_RETURN ;Enter If $iSuggest Then Return _WinAPI_PostMessage($hWnd, $WM_SUGGESTWORD_END, 1, 0) ;will end the process $cOffset = _GUICtrlEdit_GetSel($hWnd) If $cOffset[0] = $cOffset[1] Then $cOffset = _GetCaretOffset($IDFrom) If BitAND(_CtrlGetStyle($hWnd), $ES_MULTILINE) Then _GUICtrlEdit_InsertText($hWnd, @CRLF, $cOffset) ;Send @CRLF to a MultiLine Control ;Also Check For New Word $_NewWord = _GetCurrentWord($IDFrom, $cOffset - 2, 1) Return _SendMessage($hWnd, $WM_ADDWORD, $wParam, $lParam) EndIf Else ;Something is Selected _GUICtrlEdit_SetSel($hWnd, -1, -1) ;Deselect Selection EndIf Case $VK_SPACE ;Spacebar ;New Word - Add To The List $cOffset = _GetCaretOffset($IDFrom) $_NewWord = _GetCurrentWord($IDFrom, $cOffset - 1) _WinAPI_PostMessage($hWnd, $WM_ADDWORD, 0, 0) Case $VK_BACK ;BackSpace _GUICtrlEdit_ReplaceSel($hWnd, '') ContinueCase Case $VK_ESCAPE, $VK_LEFT, $VK_RIGHT If $iSuggest Then Return _WinAPI_PostMessage($hWnd, $WM_SUGGESTWORD_END, 0, 0) Case $VK_DOWN, $VK_UP If $iSuggest Then Local Const $iMax = _GUICtrlListBox_GetCount($___hSuggestListWindow) - 1 $aRet = $wParam - 39 + _GUICtrlListBox_GetCurSel($___hSuggestListWindow) If $aRet < 0 Or $aRet > $iMax Then Return 0 _GUICtrlListBox_SetCurSel($___hSuggestListWindow, $aRet) Return 1 EndIf EndSwitch Case $WM_CHAR ;WM_CHAR Switch $wParam Case $VK_SPACE + 1 To 255 ;Printing Chars in ANSI set [Exclusive of Space and DEL] If $___iType = 0 Then _WinAPI_PostMessage($hWnd, $WM_PREDICTWORD, 0, 0); Else _WinAPI_PostMessage($hWnd, $WM_SUGGESTWORD_PROCESS, 0, 0) EndIf Case $VK_SPACE Return _SendMessage($hWnd, $WM_PREDICTPHRASE, $wParam, $lParam) EndSwitch Case $WM_KILLFOCUS _WinAPI_PostMessage($hWnd, $WM_SUGGESTWORD_END, 0, 0) Case $EM_SETPASSWORDCHAR If $wParam <> 0 Then _UnRegisterPrediction() ; Unregister Prediction if a Password Character is Set EndSwitch ; Pass to the Original Window Procedure. Return _WinAPI_CallWindowProc($___pOld_WndProc, $hWnd, $iMsg, $wParam, $lParam) Case $___hSuggestListWindow Switch $iMsg Case $WM_MOUSEACTIVATE ;don't take focus from edit control. _WinAPI_PostMessage($___cEdit, $WM_SUGGESTWORD_END, 1, 0) Local Const $MA_NOACTIVATEANDEAT = 4 Return $MA_NOACTIVATEANDEAT Case $WM_MOUSEMOVE Local $iITem = _GUICtrlListBox_ItemFromPoint($___hSuggestListWindow, _WinAPI_LoWord($lParam), _WinAPI_HiWord($lParam)) If $iITem > -1 Then _GUICtrlListBox_SetCurSel($hWnd, $iITem) EndSwitch Return _WinAPI_CallWindowProc($___pOldList_WndProc, $hWnd, $iMsg, $wParam, $lParam) EndSwitch EndFunc ;==>_New_WndProc
  24. Rather than replacing each variable with a corresponding array, I used the fact that only one richedit could be used at a time, therefore Added two functions _Edit_List_Suspend() and _Edit_List_Restore(). So that multiple richedits could be used at a time. I even provided an example. Please check the original post. Regards Phoenix XL
×
×
  • Create New...