Jump to content

ControlTreeView


Recommended Posts

I offered him a cookie. We'll see how that works. I might have to add a glass of milk...

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I offered him a cookie. We'll see how that works. I might have to add a glass of milk...

Jarvis

You want Gary, or Kat?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

@GaryFrost

Thanks for the assistance there. The examples in the helpfile didn't give me much information, but below is what I finally figured out would work.

$h_TreeView = ControlGetHandle("Customize Classic Start Menu", "", "SysTreeView321")
    $h_Item = _GUICtrlTreeView_FindItem($h_TreeView, "Use Personalized Menus")
    _GUICtrlTreeView_SetImageIndex($h_TreeView, $h_Item, True) ; UnCheck
    _GUICtrlTreeView_SetImageIndex($h_TreeView, $h_Item, False) ; Check
Also, you will notice "true" makes it uncheck, and "false" makes it check. Doesn't make much sense, but it works.

Thanks,

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

@GaryFrost

Thanks for the assistance there. The examples in the helpfile didn't give me much information, but below is what I finally figured out would work.

$h_TreeView = ControlGetHandle("Customize Classic Start Menu", "", "SysTreeView321")
    $h_Item = _GUICtrlTreeView_FindItem($h_TreeView, "Use Personalized Menus")
    _GUICtrlTreeView_SetImageIndex($h_TreeView, $h_Item, True); UnCheck
    _GUICtrlTreeView_SetImageIndex($h_TreeView, $h_Item, False); Check
Also, you will notice "true" makes it uncheck, and "false" makes it check. Doesn't make much sense, but it works.

Thanks,

Jarvis

The third parameter is not supposed to be a boolean True/False, but a 0-based index. When AutoIt expects an integer and gets something else, there is often a conversion by Number(). For example:
$Var = True
ConsoleWrite("$Var = " & $Var & @LF)
$Var = Number($Var)
ConsoleWrite("$Var = " & $Var & @LF)

$Var = False
ConsoleWrite("$Var = " & $Var & @LF)
$Var = Number($Var)
ConsoleWrite("$Var = " & $Var & @LF)

You are getting index = 1 for 'True' and index = 0 for 'False'. These just happen to match the uncheck and check images you want. If the required indexes were 3 and 4 that wouldn't have worked. So you can make that:

_GUICtrlTreeView_SetImageIndex($h_TreeView, $h_Item, 1); UnCheck
    _GUICtrlTreeView_SetImageIndex($h_TreeView, $h_Item, 0); Check

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...