Jump to content
Sign in to follow this  
JSThePatriot

ControlTreeView

Recommended Posts

JSThePatriot

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)

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
GaryFrost

M$ rarely uses standard checkboxes in the controls.

try looking at: _GUICtrlTreeView_SetStateImageIndex and _GUICtrlTreeView_GetStateImageIndex


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
JSThePatriot

@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)

Share this post


Link to post
Share on other sites
PsaltyDS

@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

Share this post


Link to post
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
Sign in to follow this  

×