Jump to content

Graphics Ctrl > SS_NOTIFY


Recommended Posts

um, im trying to see if a graphics control has been clicked.. how would i go about doing this? any examples?

i know its probably obvious, but i've been searching the help file, all it says is it "Sends the parent window the STN_CLICKED notification when the user clicks the control." is STN_CLICKED a variable or something..? Im confused...

Link to comment
Share on other sites

  • Moderators

taurus905 was working on something the other day that had a good example... let me see if I can find it:

http://www.autoitscript.com/forum/index.ph...st&p=205355

The second example there I believe with the msgbox's.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

i don't understand...

am i doing something wrong?

Func PaletteUpdate($avArray)
    Switch GUIGetMsg()
        Case $avArray[1]
            GUICtrlSetBkColor($avArray[0], 0x000000)
    EndSwitch
EndFunc

$avArray[1] is a graphic control...

Well... that doesn't tell us a whole lot :D

Is $avArray actually an array, and is it actually a ControlID?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Instead of explaining to everybody what your array contains, how about doing the logical thing and just write an example that doesn't use an array so that the people here can see a real, non-working example.

Think about it like this. You're asking for support. Clearly there is some deficiency in your ability to write AutoIt code in this instance because you need help. So how can anybody be reasonably expected to rely on your word only that the array data is exactly as you think it is?

Link to comment
Share on other sites

I need the array... thats why i did'nt post a non-array version of that.. lol

here is some WORKING code, except im having trouble with the PaletteUpdate function. I need to check which ctrl was clicked and set the bk color of $avArray[0] to the corresponding color... I can do that pretty easily... The main problem is, checking if $avArray[x] was clicked.

#include <guiconstants.au3>
#include <array.au3>
;Library

Func PaletteUpdate($avArray)
    Switch GUIGetMsg()
        Case $avArray[1]
            MsgBox(0, "", "")
    EndSwitch
    
EndFunc

    
Func CreateColorPalette($xpos, $ypos, $width, $height)
    Dim $avPalette[29]
    $avPalette[0] = GUICtrlCreateGraphic($xpos, $ypos, $width*2, $height*2, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $avPalette[1] = GUICtrlCreateGraphic($xpos+$width*2, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x000000)
    $avPalette[2] = GUICtrlCreateGraphic($xpos+$width*3, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x666666)
    $avPalette[3] = GUICtrlCreateGraphic($xpos+$width*4, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x660000)
    $avPalette[4] = GUICtrlCreateGraphic($xpos+$width*5, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x999900)
    $avPalette[5] = GUICtrlCreateGraphic($xpos+$width*6, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x006600)
    $avPalette[6] = GUICtrlCreateGraphic($xpos+$width*7, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x669999)
    $avPalette[7] = GUICtrlCreateGraphic($xpos+$width*8, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x000066)
    $avPalette[8] = GUICtrlCreateGraphic($xpos+$width*9, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x660066)
    $avPalette[9] = GUICtrlCreateGraphic($xpos+$width*10, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x999966)
    $avPalette[10] = GUICtrlCreateGraphic($xpos+$width*11, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x006666)
    $avPalette[11] = GUICtrlCreateGraphic($xpos+$width*12, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x3399CC)
    $avPalette[12] = GUICtrlCreateGraphic($xpos+$width*13, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x336699)
    $avPalette[13] = GUICtrlCreateGraphic($xpos+$width*14, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x9933CC)
    $avPalette[14] = GUICtrlCreateGraphic($xpos+$width*15, $ypos, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x663300)
    $avPalette[15] = GUICtrlCreateGraphic($xpos+$width*2, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $avPalette[16] = GUICtrlCreateGraphic($xpos+$width*3, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x999999)
    $avPalette[17] = GUICtrlCreateGraphic($xpos+$width*4, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFF0000)
    $avPalette[18] = GUICtrlCreateGraphic($xpos+$width*5, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFFFF00)
    $avPalette[19] = GUICtrlCreateGraphic($xpos+$width*6, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x00FF00)
    $avPalette[20] = GUICtrlCreateGraphic($xpos+$width*7, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x00FFFF)
    $avPalette[21] = GUICtrlCreateGraphic($xpos+$width*8, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0x0000FF)
    $avPalette[22] = GUICtrlCreateGraphic($xpos+$width*9, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFF00FF)
    $avPalette[23] = GUICtrlCreateGraphic($xpos+$width*10, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFFFFCC)
    $avPalette[24] = GUICtrlCreateGraphic($xpos+$width*11, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xCCFFCC)
    $avPalette[25] = GUICtrlCreateGraphic($xpos+$width*12, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xCCFFFF)
    $avPalette[26] = GUICtrlCreateGraphic($xpos+$width*13, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xCCCCFF)
    $avPalette[27] = GUICtrlCreateGraphic($xpos+$width*14, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFF00FF)
    $avPalette[28] = GUICtrlCreateGraphic($xpos+$width*15, $ypos+$height, $width, $height, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFF9933)
    Return $avPalette
EndFunc



;Tests
GUICreate("")
$avCtrl = CreateColorPalette(10, 10, 15, 15)
GUISetState()
While 1
    PaletteUpdate($avCtrl)
WEnd
Edited by CHRIS95219
Link to comment
Share on other sites

  • Moderators

I sent you to the link that would have answered your question earler ($SS_NOTIFY)

Func PaletteUpdate($avArray)
    $Msg = GUIGetMsg()
    For $iCount = 1 To UBound($avArray) - 1
        If $Msg = $avArray[$iCount] Then MsgBox(0, 'Hmm', 'Test ... $avPalette[' & $iCount & '] was clicked')
    Next
    If $Msg = - 3 Then Exit
EndFunc

   
Func CreateColorPalette($xpos, $ypos, $width, $height)
    Local $avPalette[29]
    Local $BkGroundArray1[15] = ['', 0x000000, 0x666666, 0x660000, 0x999900, 0x006600, 0x669999, 0x000066, _
    0x660066, 0x999966, 0x006666, 0x3399CC, 0x336699, 0x9933CC, 0x663300]
    Local $BkGroundArray2[15] = ['', 0xFFFFFF, 0x999999, 0xFF0000, 0xFFFF00, 0x00FF00, 0x00FFFF, 0x0000FF, _
    0xFF00FF, 0xFFFFCC, 0xCCFFCC, 0xCCFFFF, 0xCCCCFF, 0xFF00FF, 0xFF9933]
    
    $avPalette[0] = GUICtrlCreateGraphic($xpos, $ypos, $width*2, $height*2, $WS_BORDER)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    
    For $iCount = 1 To 14
        $avPalette[$iCount] = GUICtrlCreateGraphic($xpos+$width * ($iCount + 1), $ypos, $width, $height, BitOR($SS_NOTIFY, $WS_BORDER))
        GUICtrlSetBkColor($avPalette[$iCount], $BkGroundArray1[$iCount])
    Next
    For $iCount = 1 To 14
        $avPalette[$iCount + 14] = GUICtrlCreateGraphic($xpos+$width * ($iCount + 1), $ypos+$height, $width, $height, BitOR($SS_NOTIFY, $WS_BORDER))
        GUICtrlSetBkColor($avPalette[$iCount + 14], $BkGroundArray2[$iCount])
    Next
    Return $avPalette
EndFunc



;Tests
GUICreate("")
$avCtrl = CreateColorPalette(10, 10, 15, 15)

GUISetState()
While 1
    PaletteUpdate($avCtrl)
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

hmm... Thanks! I still don't see how my other code does'nt work. GUICtrlCreateGraphic() says in the help file that $SS_NOTIFY is automatically there.. its a default..

It is there by "default", but when you used $WS_BORDER you wiped it out.

Edit:

Just because something says it's "default" doesn't mean it's hard coded :D

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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