Jump to content

Horizontal Tab ( @TAB ) in combobox


Recommended Posts

Hi there fallos, im in lose here, need help.

i have a combobox ctrl, k?

i populate the combobox with data   ->   'a|b|c|d|bla|bla' , k?

now, i want to add another item with @TAB in the middle   ->   'zaa' & @TAB & 'zoo', k?

the item adds just fine, but, if i dropdown the combobox list to select somthing,

i see   ->   zaazoo

after selecting it and the dropdown closes, i see the correct format ->

zaa @TAB zoo,   ie,   zaa        zoo

how to tell or format or whatever the dropdow list to show   ->

zaa        zoo     and  NOT   zaazoo   ???

 

thank you very very veerrryy much.

Link to comment
Share on other sites

  • Moderators

Must you use @TAB? This works just fine for me, just adding spaces:

$combo = GUICtrlCreateCombo("", 10, 10, 100, 40)
    GUICtrlSetData(-1, "a|b|c|d|Zaa    zoo", "")
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Anomalous,

Welcome to the AutoIt forum. :)

Interesting question. You can set a style for a ListBox which makes it expand tabs, but this does nto seem to work for a combo - as you can see here:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>
#include <GUIComboBox.au3>

Global $tInfo
Global $aTabs[4] = [3, 100, 200, 300]

$hGUI = GUICreate("Test", 500, 500)

; Create combo
$cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20)
; Get handle to list element
_GUICtrlComboBox_GetComboBoxInfo($cCombo, $tInfo)
$hList = DllStructGetData($tInfo, "hList")
; Add style
$iStyle = _WinAPI_GetWindowLong($hList, $GWL_STYLE)
_WinAPI_SetWindowLong($hList, $GWL_STYLE, BitOR($iStyle, $LBS_USETABSTOPS))
; Set tab stops
_GUICtrlListBox_SetTabStops($hList, $aTabs)
; Add data
GUICtrlSetData($cCombo, "a|zaa" & @TAB & "zoo|b|c|d|bla|bla")

; Create list with style
$cList = GUICtrlCreateList("", 10, 100, 200, 200, BitOR($LBS_STANDARD, $LBS_USETABSTOPS))
; Set tab stops
_GUICtrlListBox_SetTabStops($cList, $aTabs)
; Add data
GUICtrlSetData($cList, "a|zaa" & @TAB & "zoo|b|c|d|bla|bla")

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
I will keep looking to see if I can find anything else. :)

M23

Edit: I have now found a definitive MS statement that combos do not have that functionality. If you must use a tab then my only suggestion is creating your own combo. I will see what I can do this afternoon. :)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

JLogan3o13

yes, i have to use  @TAB .

i tried using spaces but i can not align the various list items in the right way.

here's an example, using  2  and  3  and more spaces 

the  is   line    one

create   big     boss

zing      zong   zang

creepy            crawlers

i need that all the parts be seen on the same vertical line. you can see that thay are not.

why ? it does not metter, i just need it that way and cant find the right way to do that

:bye:

@  Melba23

thank you for trying, if u'll find an answer, i'll be glad to know,    :sorcerer:

Link to comment
Share on other sites

  • Moderators

Anomalous,

I found an old script I could quickly modify: :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListBox.au3>

Global $aTabs[4] = [3, 100, 200, 300]
Global $fShow = False, $fClick = False

$hGUI = GUICreate("Example", 500, 500)

$cInput = GUICtrlCreateInput("", 10, 10, 180, 20)
$cButton = GUICtrlCreateButton("v", 190, 10, 20, 20)

GUISetState(@SW_SHOW, $hGUI)

; Create child GUI to hold list
$hGUI_Child = GUICreate("Child", 200, 200, 10, 30, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
$cList = GUICtrlCreateList("", 0, 0, 200, 200, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_USETABSTOPS))
GUICtrlSetResizing($cList, $GUI_DOCKAUTO) ; List resizes with GUI
; Set tab stops
_GUICtrlListBox_SetTabStops($cList, $aTabs)
; Add data
GUICtrlSetData($cList, "a|zaa" & @TAB & "zoo|b|c|d|bla|bla")
GUISetState(@SW_HIDE, $hGUI_Child)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            Switch $fShow
                Case False
                    GUISetState(@SW_SHOW, $hGUI_Child)
                    $fShow = True
                Case True
                    GUISetState(@SW_HIDE, $hGUI_Child)
                    $fShow = False
            EndSwitch
    EndSwitch

    ; If list has been clicked
    If $fClick Then
        $fClick = False
        GUICtrlSetData($cInput, GUICtrlRead($cList))
        GUISetState(@SW_HIDE, $hGUI_Child)
        $fShow = False
    EndIf

WEnd

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    ; Check it is the correct list
    If $lParam = GUICtrlGetHandle($cList) Then
        ; If new item selected
        If BitShift($wParam, 16) = $LBN_SELCHANGE Then
            $fClick = True
        EndIf
    EndIf
EndFunc   ;==>_WM_COMMAND
Any use? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@  Melba23

well, it does display   zaa    zoo   and not  zaazoo   but its not a real combobox ... right ?    :shifty:

maybe i can modify your code to be more   comboboxy .. and have it my way     heheheheh

:thumbsup:

thanks again 4 trying and if ya do find some sort of answer, please share.

Link to comment
Share on other sites

  • Moderators

Anomalous,

 

but its not a real combobox

As I pointed out above, MS state quite clearly that "real" combos do not have the functionality to expand tabs, so something like this is probably as good as you will get. By all means modify the example code as much as you wish - anything I post here is free to use. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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