Jump to content

how to set a listbox on top..


Recommended Posts

hey here's my problem:

My lisbox gets overlapped by inputbox.. I want to set the listbox on top and prevent this..

How can i do that?

P.S. I used GUIctrlsetstate($list,$gui_ontop)

doesn't work.. dunno why.. some help pls

Edited by Manjish
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Hi Here's the code I am using.. Maybe this will give u an idea of what i am facing..

#include <GUIConstantsEx.au3>
#include <Excel.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <ScrollBarConstants.au3>
#include <ListviewConstants.au3>
#Include <GuiComboBoxEx.au3>
#include<editconstants.au3>
#include<array.au3>
#include<guilistbox.au3>

Global $INPUT, $LIST, $LIST_DATA = "", $KEYWORD[10000], $NEW_DATA = "|",$m=0

Global $Form2 = GUICreate("Media Manager", 763, 747, 191, 112)
GUISetBkColor(0xdcdcdc)
$Group1 = GUICtrlCreateGroup("Procurement Form", 0, 0, 761, 745)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$date=GUICtrlCreateDate(@YDAY&"/"&@MON&"/"&@MDAY, 416, 120, 150, 21)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label1 = GUICtrlCreateLabel("Procured By:", 24, 120, 80, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label2 = GUICtrlCreateLabel("BU/Team", 24, 176, 51, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label3 = GUICtrlCreateLabel("Mobile No.", 24, 232, 100, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label4 = GUICtrlCreateLabel("Date", 352, 120, 60, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label5 = GUICtrlCreateLabel("EID No.", 352, 176, 42, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label6 = GUICtrlCreateLabel("Name of Granting Authority", 272, 232, 200, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
Global $name = GUICtrlCreateInput("", 96, 120, 160, 21)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$LIST = GUICtrlCreateList("",96,141,160,80,$WS_EX_TOPMOST )
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetState(-1, $GUI_HIDE)
$BU = GUICtrlCreateInput("", 96, 176, 97, 21)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$EID = GUICtrlCreateInput("", 416, 176, 105, 21)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$mobile = GUICtrlCreateInput("", 96, 232, 153, 21,$ES_NUMBER)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
Global $GA = GUICtrlCreatecombo("", 440, 232, 150, 21)
GUICtrlSetData(-1,"Sachin Polekar|Rajashri Kulkarni|Manjish Naik|Soumya Jyoti Ghosh|Other")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label7 = GUICtrlCreateLabel("Please Enter the Items to be procured. (Select the Release Version and  type of media).", 24, 288, 550, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label8 = GUICtrlCreateLabel("Example: R310.3 Application Media.", 40, 320, 250, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label10 = GUICtrlCreateLabel("", 8, 40, 4, 4)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label11 = GUICtrlCreateLabel("e.g. EBG-QPS", 208, 176, 72, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label12 = GUICtrlCreateLabel("e.g. E437409", 536, 176, 68, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Pic1 = GUICtrlCreatePic(@ScriptDir&"\MM_Logo.JPG", 208, 16, 345, 68)
$Label13 = GUICtrlCreateLabel("1.", 64, 384, 13, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label14 = GUICtrlCreateLabel("2.", 64, 432, 13, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label15 = GUICtrlCreateLabel("3.", 64, 480, 13, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label16 = GUICtrlCreateLabel("4.", 64, 528, 13, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label17 = GUICtrlCreateLabel("5.", 64, 576, 13, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label18 = GUICtrlCreateLabel("Media Type", 565, 352, 100, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label19 = GUICtrlCreateLabel("Release", 192, 352, 43, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$R1 = GUICtrlCreateCombo("", 128, 384, 177, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 311.2|EPKS R 400")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$B1 = GUICtrlCreateInput("", 320, 384,180, 21)
GUICtrlSetState(-1,$gui_disable)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T1 = GUICtrlCreateCombo("", 510, 384, 200, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$R2 = GUICtrlCreateCombo("", 128, 432, 177, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 311.2|EPKS R 400")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$B2 = GUICtrlCreateInput("", 320, 432, 180, 21)
GUICtrlSetState(-1,$gui_disable)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T2 = GUICtrlCreateCombo("", 510, 432, 200, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$R3 = GUICtrlCreateCombo("", 128, 480, 177, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 311.2|EPKS R 400")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$B3=GUICtrlCreateInput("", 320, 480, 180, 21)
GUICtrlSetState(-1,$gui_disable)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T3 = GUICtrlCreateCombo("", 510, 480, 200, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$R4 = GUICtrlCreateCombo("", 128, 528, 177, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 311.2|EPKS R 400")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$B4=GUICtrlCreateInput("", 320, 528, 180, 21)
GUICtrlSetState(-1,$gui_disable)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T4 = GUICtrlCreateCombo("", 510, 528, 200, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$R5 = GUICtrlCreateCombo("", 128, 576, 177, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "Windows Server 2000|Windows Client 2000|Windows XP|Windows Server 2003|Windows Server 2008|Windows 7|Windows Vista|EPKS R200 or Older|EPKS R 301.1|EPKS R 301.2|EPKS R 301.3|EPKS R 310.2|EPKS R 310.3|EPKS R 311.2|EPKS R 400")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$B5=GUICtrlCreateInput("", 320, 576, 180, 21)
GUICtrlSetState(-1,$gui_disable)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$T5 = GUICtrlCreateCombo("", 510, 576, 200, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetData(-1, "EXPPlus Media|Application Media|Knowledge Builder|CAB|MSDN|CAB+MSDN|Support Software")
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Enter = GUICtrlCreateButton("Enter", 200, 656, 161, 33, 0)
GUICtrlSetBkColor(-1,0x708090)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUIctrlSetState(-1,$gui_defbutton)
$Cancel = GUICtrlCreateButton("Cancel", 380, 656, 161, 33, 0)
GUICtrlSetBkColor(-1,0x708090)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Labelbid = GUICtrlCreateLabel("Build ID", 380, 352, 100, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label20 = GUICtrlCreateLabel("If other, specify name:", 312, 264, 150, 17)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetState(-1,$gui_hide)
$Checkbox1 = GUICtrlCreateCheckbox("Auto-Populate?", 304, 88, 129, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
Global $other= GUICtrlCreateInput("", 440, 264, 150, 21)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
GUICtrlSetState(-1,$gui_hide)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Keywords()
$sCurr_Input = ""

While 1
    

If GUICtrlRead($name) <> "" And BitAND(GUICtrlGetState($LIST), $GUI_HIDE) = $GUI_HIDE And $NEW_DATA <> "|"And _GUICtrlListBox_GetCount($list)>=2 Then 
    GUICtrlSetState($LIST,$gui_ontop)
    GUICtrlSetState($LIST, $GUI_SHOW)
    
EndIf     
If GUICtrlRead($name) <> "" And BitAND(GUICtrlGetState($LIST), $GUI_SHOW) = $GUI_SHOW And $m=1  Then 
         $m=0
         GUICtrlSetState($LIST, $GUI_HIDE) ;<<<<<<<<< hide listbox when choice has been made!!
EndIf
    If GUICtrlRead($name) =  "" And BitAND(GUICtrlGetState($LIST), $GUI_SHOW) = $GUI_SHOW  Then GUICtrlSetState($LIST, $GUI_HIDE)

    ; If input has changed, refill list with matching items
    If GUICtrlRead($name) <> $sCurr_Input Then 
        CheckInputText()
        $sCurr_Input = GUICtrlRead($name)
    EndIf


$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($form2)
main()
Case $LIST
            $sChosen = GUICtrlRead($LIST)
            If $sChosen <> "" Then 
                $m=1
                sleep(250)
                GUICtrlSetData($name, $sChosen)
            EndIf

    
Case $cancel
    guidelete($form2)
    main()
EndSwitch
WEnd

Func Keywords()
$file=FileOpen(@ScriptDir&"\list.txt",0)
    ; Only items beginning with B created - so able to see what happens when list holds nothing (hides) or lots of data (scrolls)
    For $INDEX = 0 To 100000
        
        $KEYWORD[$INDEX] = FileReadLine($file)
        If $keyword[$index]="" Then ExitLoop
        $LIST_DATA &= $KEYWORD[$INDEX] & "|"
    Next
    GUICtrlSetData($LIST,$LIST_DATA)
EndFunc

Func CheckInputText()
    $l=StringLen(guictrlread($name))
    $NEW_DATA = "|"  ; Start with delimiter so new data always replaces aold
    $READ = GUICtrlRead($name)
    If $READ <> "" Then
        For $INDEX = 0 To 99
            If StringLeft($KEYWORD[$INDEX],$l) = $READ Then $NEW_DATA &= $KEYWORD[$INDEX] & "|"
        Next
        GUICtrlSetData($LIST,$NEW_DATA)
    EndIf
EndFunc
Edited by Manjish
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Link to comment
Share on other sites

@yashied

no...still not working.. i placed the list below ip box.. still doesnt work

The reason why this is happening is because, the list is initially hidden.. and becomes visible as the last item in the gui.. so it is populated after the inputbox..

Now how do i solve this?

Edited by Manjish
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

Link to comment
Share on other sites

@yashield

Well thats not a problem.. Its a necessity.. If u take a look at what I am trying to do.. u would understand why i need to run guictrlsetstate in a loop..

Anyways, I found another solution to this problem.. I just hide the inputbox when listbox is visible and vice versa.. and its working the way i want it to..

Thanks for your help!!

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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...