Jump to content

Cannot change Input Bkcolor with $WS_CLIPCHILD?


 Share

Recommended Posts

The following codes change the background color of an Input control when the small embedded IE object refreshes, and changes it back after a certain time.

#include <GUIConstants.au3>
#include <IE.au3>

; === Initialization ====================================================
; =======================================================================

; Register IE Object Error Handler
_IEErrorHandlerRegister()

; Create the main GUI and embed an IE Object and nagivates to the homepage

; ##HELP## IE objects are displayed properly, but GUICtrlSetBkcolor won't work
;~ $guiparent = GUICreate( "MyApp", 457, 500, -1, -1, $WS_SYSMENU + $WS_CLIPCHILDREN )

; ##HELP## GUICtrlSetBkcolor works when $WS_CLIPCHILDREN is not set, but IE shows blank when second IE refreshes
$guiparent = GUICreate( "MyApp", 457, 500, -1, -1, $WS_SYSMENU )


$oie = _IECreateEmbedded()
$ax = GUICtrlCreateObj( $oIE, 4, 4, 449, 410 )
$oie2 = _IECreateEmbedded()
GUICtrlCreateObj( $oie2, 320, 420, 100, 50 )
GUICtrlCreateLabel( "USL:", 6, 418, 36, 18, $SS_RIGHT )
$lbl_lvl = GUICtrlCreateInput( "", 46, 418, 60, 18, $ES_READONLY )

GUISetState()

_IENavigate( $oIE, "[url="http://www.yahoo.com"]http://www.yahoo.com[/url]", 1 )

; =======================================================================
; =======================================================================

$lastupdate = 0
$readystate = 0
$lastcolor = 0
$resetcolor = 0
$lastsec = @SEC

While 1
 
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
 
 ; reload the small frame
 If TimerDiff( $lastupdate ) >= 15000 Then
  ConsoleWrite( "Reload" & @CRLF )
  _IENavigate( $oie2, "[url="http://checkip.dyndns.org/"]http://checkip.dyndns.org/[/url]", 0 )
  $readystate = 0
  $lastupdate = TimerInit()
 EndIf
 
 ; if the page has finish loading then highlight the input control 
 If $readystate <> 4 Then
  $readystate = _IEPropertyGet( $oie2, "readystate" )
  If $readystate = 4 Then 
   ConsoleWrite( "Load Complete" & @CRLF )
   $lastcolor = TimerInit()
   GUICtrlSetBkColor( $lbl_lvl, "0xFFFF00" )
   $resetcolor = 1
  EndIf
 EndIf 

 ; after a certain time, dehighlight the input control
 If TimerDiff( $lastcolor ) >= 5000 And $resetcolor = 1 Then 
  ConsoleWrite( "Reset color" & @CRLF )
  GUICtrlSetBkColor( $lbl_lvl, "0xFFFFFF" )
  $resetcolor = 0
 EndIf
 
Wend

When $WS_CLIPCHILDREN is set, the embedded IE displays correctly, but the GUICtrlSetBkcolor won't work.

When $WS_CLIPCHILDREN is not set, the GUICtrlSetBkcolor works, but the embedded IE would go blank.

Can someone give me any assistant as to how to get both working at the same time?

Link to comment
Share on other sites

put the GUISetBkColor() under your guicreate() like this:

$Gui = GUICreate("Desktop Cleaner V1.03", 385, 185, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor (0x1a1c1d)

this changed the background color of my script

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

In your case it would go under:

$guiparent = GUICreate( "MyApp", 457, 500, -1, -1, $WS_SYSMENU )

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

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