Jump to content

Help with scrolling GUI Control


Recommended Posts

HELP!

I have a script that pulls a list of user's from an Active Directory container. What I'm wanting to do is make the GUICtrlCreateGroup "GUI" have an active vertical scroll bar. Most of the time, the user list can be small, but sometime the user list can be long and exceeds the group limits. I'd rather not make this a larger window to accomadate a longer list...that's why I thought a scrolling window would work best, but...hmmmm :mellow: , i'm stumped on how to get that done.

Any help would be much appriciated. :)

Here's what i've got so far...

#include <AD.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

; Open Connection to the Active Directory 
_AD_Open() 

; Get FQDN for the currently logged on user 
Global $sFQDN = _AD_SamAccountNameToFQDN() 

; Strip off the CN 
Global $iPos = StringInStr($sFQDN, ",") 
Global $sOU = StringMid($sFQDN, $iPos + 1) 
Global $sUser = StringLeft(@UserName, 1) 
Global $aObjects[1][1] 

$sOU = "OU=Users,DC=ACME,DC=ACMECO" 
$aObjects = _AD_GetObjectsInOU($sOU, "(&(objectcategory=person)(objectclass=user))", 2, "sAMAccountName,mail,displayname") 

Global $iX = 50 ; Starting X-pos 
Global $iY = 100 ; Starting Y-pos 

$UserListMainGUI = GUICreate("", 400, 280, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) 
$Label1 = GUICtrlCreateLabel("Attention...", 25, 8, 500, 25, $SS_CENTERIMAGE) 
GUICtrlSetFont(-1, 12, 800, 0, "Arial") 
GUICtrlSetColor(-1, 0xff0000) ;Red 
$Label2 = GUICtrlCreateLabel("Please select your name from the list below:", 25, 28, 500, 25, $SS_CENTERIMAGE) 
GUICtrlSetFont(-1, 12, 800, 0, "Arial") 
GUICtrlSetColor(-1, 0x0000ff) ;Blue 
$UserListGroup = GUICtrlCreateGroup("", 24, 80, 350, 100, $WS_VSCROLL) 
GUICtrlCreateGroup("", -99, -99, 1, 1) 
$UserListOKButton = GUICtrlCreateButton("OK", 160, 205, 75, 25, BitOR($BS_DEFPUSHBUTTON,$BS_PUSHLIKE,$WS_GROUP)) 
GUICtrlSetResizing($UserListGroup, $GUI_DOCKALL) 
GUISetState(@SW_HIDE)

_GUIScrollBars_Init($UserListGroup) 
_GUIScrollBars_EnableScrollBar($ListGroup, $SB_VERT) 

Global $Radios[$aObjects[0][0] + 1] 

For $aX = 1 To $aObjects[0][0] 
$Radios[$aX] = GUICtrlCreateRadio($aObjects[$aX][2], $iX, $iY, 200, 17) 
$iY += 20 
Next 

If @error > 0 Then 
MsgBox(64, "Active Directory Function", "No OUs could be found") 
Else 
GUISetState(@SW_SHOW, $UserListMainGUI) 
EndIf 


While 1 
$nMsg = GUIGetMsg() 
Switch $nMsg 
Case $GUI_EVENT_CLOSE 
Exit 
EndSwitch 
WEnd 

; Close Connection to the Active Directory 
_AD_Close() 
exit
Link to comment
Share on other sites

GUICtrlCreateGroup is just a visual box outline that groups control boxes together. It is nothing more than a visual outline. You are forcing scrollbars on to it and it cannot do anything with them. You have to put scrollbars on items that support them and have data. Create a dropdown list or an inputbox. Then you can use scrollbars. Example:

Posted Image

Edited by sleepydvdr

#include <ByteMe.au3>

Link to comment
Share on other sites

GUICtrlCreateGroup is just a visual box outline that groups control boxes together. It is nothing more than a visual outline. You are forcing scrollbars on to it and it cannot do anything with them. You have to put scrollbars on items that support them and have data. Create a dropdown list or an inputbox. Then you can use scrollbars. Example:

Sleepydvdr,

Thanks for the information...don't know why I thought I could scroll a Group Control. :mellow:

Since I want to use radio buttons i'm going to have to rethink my aproach.

Thanks again!! :)

HockeyFan.

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