Jump to content

Search and select (need it asap)ty!


wafuh
 Share

Recommended Posts

Hi there!

I need a little help from all the gurus out there!

im making a mini program my problem is how am i gonna make my searched line be selected and put in on the top of the list.

Here's my interface:

#include <GUIConstants.au3>

;window

$Window = GUICreate("Seach&Select", 1185, 552, 66, 60,BitAND($WS_SIZEBOX, $WS_SYSMENU,$WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_BORDER))

$WinGroup = GUICtrlCreateGroup("", 0, 0, 1161, 537)

$ListView1 = GUICtrlCreateListView("Customer Account Number|Business Name|Contact1|Phone1|Phone2|FLag2|Contact2|Model|Date Item Ordered|Installation Date|Time Zone", 96, 216, 1017, 113)

$Can= GUICtrlCreateListViewItem("3616967313|ENTERPRISE PRO|LANDR|36212365|41654|AP|n/a|042|07/08/2007|07/10/2007|Eastern",$ListView1)

$Can1= GUICtrlCreateListViewItem("4824967318|ERIC R|KRIST|602329|4654|AP|Rachel|073|06/05/2007|06/18/2007|Pacific",$ListView1)

$Can1= GUICtrlCreateListViewItem("8946546567|SCOT|KAREN|26232983|AP|n/a|041|08/12/2007|08/22/2007|Western",$ListView1)

;Search

$CAN = GUICtrlCreateInput("Customer Account No", 45, 77, 97, 21)

$AssignButton = GUICtrlCreateButton("Search", 42, 182, 105, 17, 0)

$Input2 = GUICtrlCreateInput("Phone Number", 42, 115, 97, 21)

$Input5 = GUICtrlCreateInput("Meter Type", 47, 151, 97, 21)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

If @DesktopWidth = 1280 And @DesktopHeight = 1024 Then

WinMove($Window, '', Default, Default, 900, 700)

ElseIf @DesktopWidth > 1280 Then

WinMove($Window, '', 10, 10, @DesktopWidth - 20, @DesktopHeight - 20)

EndIf

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

;--------------------------------------------

i also have my attched screen sample

please help

post-30142-1198840418_thumb.jpg

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

;window
$Window = GUICreate("Seach&Select", 1185, 552, 66, 60, BitAND($WS_SIZEBOX, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_BORDER))
$WinGroup = GUICtrlCreateGroup("", 0, 0, 1161, 537)

$ListView1 = GUICtrlCreateListView("Customer Account Number|Business Name|Contact1|Phone1|Phone2|FLag2|Contact2|Model|Date Item Ordered|Installation Date|Time Zone", 96, 216, 1017, 113)
$Can = GUICtrlCreateListViewItem("3616967313|ENTERPRISE PRO|LANDR|36212365|41654|AP|n/a|042|07/08/2007|07/10/2007|Eastern", $ListView1)
$Can1 = GUICtrlCreateListViewItem("4824967318|ERIC R|KRIST|602329|4654|AP|Rachel|073|06/05/2007|06/18/2007|Pacific", $ListView1)
$Can1 = GUICtrlCreateListViewItem("8946546567|SCOT|KAREN|26232983|AP|n/a|041|08/12/2007|08/22/2007|Western", $ListView1)

;Search
$inputCan = GUICtrlCreateInput("Customer Account No", 45, 77, 97, 21)
$AssignButton = GUICtrlCreateButton("Search", 42, 182, 105, 17, 0)
$Input2 = GUICtrlCreateInput("Phone Number", 42, 115, 97, 21)
$Input5 = GUICtrlCreateInput("Meter Type", 47, 151, 97, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

If @DesktopWidth = 1280 And @DesktopHeight = 1024 Then
    WinMove($Window, '', Default, Default, 900, 700)
ElseIf @DesktopWidth > 1280 Then
    WinMove($Window, '', 10, 10, @DesktopWidth - 20, @DesktopHeight - 20)
EndIf

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $AssignButton
            $iIndex = _GUICtrlListView_FindText($ListView1, GUICtrlRead($inputCan))
            If $iIndex >= 0 Then
                $sItem = _GUICtrlListView_GetItemTextString($ListView1, $iIndex)
                $iparam = _GUICtrlListView_GetItemParam($ListView1, $iIndex)
                GUICtrlDelete($iparam)
                _GUICtrlListView_InsertItem($ListView1, "", 0)
                _GUICtrlListView_SetItemText($ListView1, 0, $sItem, -1)
                _GUICtrlListView_SetItemSelected($ListView1, 0)
            EndIf
    EndSwitch
WEnd

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

Hi Gary

Thank you so much for your help..

I have read a lot about you from the forum..

I know this would help but..

my only problem is i cant install your AU3Lib :)

and maybe that is the reason why i cant use the functin you have posted for me (_GUICtrlListView_FindText & _GUICtrlListView_GetItemTextString)

My computer is under an admin rights and i have limitations on installing programs

Is there any other way you in mind?

or someone out there could help too?

I'm still searching for other alternative that can run using my AutoIt3 version v3.2.2.0

Thanks in advance!

Link to comment
Share on other sites

Hi Gary

Thank you so much for your help..

I have read a lot about you from the forum..

I know this would help but..

my only problem is i cant install your AU3Lib :)

and maybe that is the reason why i cant use the functin you have posted for me (_GUICtrlListView_FindText & _GUICtrlListView_GetItemTextString)

My computer is under an admin rights and i have limitations on installing programs

Is there any other way you in mind?

or someone out there could help too?

I'm still searching for other alternative that can run using my AutoIt3 version v3.2.2.0

Thanks in advance!

What I showed you is from the latest release 3.2.10.0

Good luck.

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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