Jump to content

pipe (|) in a combo


-=|GO7|=-
 Share

Recommended Posts

Hello !

I'd like to have a combobox with some items containing the pipe (|) caracter.

For example :

$exp_combo = GUICtrlCreateCombo("",90,38,100,-1,$CBS_DROPDOWNLIST+$WS_VSCROLL)
GUICtrlSetData(-1,"semicolon [; ]|comma [ , ]|pipe [ | ]|tab [ tab ]|Other","semicolon [; ]")

The problem is that the GUICtrlSetData use also "|" to separate the items in Combo, List & ListViewItem

How can i do this ?

Link to comment
Share on other sites

Hmmm...maybe it should be build in the support for using "||" like "\\".

So long...

Holger

Edit: I know it looks ugly, but I would use it like (if I had no possible solution for this):

GUICreate("test")

Dim $names[4]

$names[0]       = "Brown|Peter"
$names[1]       = "Black|Mr"
$names[2]       = "White|Dr"
$names[3]       = "Man|Super"

$precomboval = ""
For $i = 0 To 2
    $precomboval = $precomboval & StringReplace($names[$i],"|"," I ") & "|"
Next
$precomboval = $precomboval & StringReplace($names[$i],"|"," I ")

Msgbox(0,"precomboval",$precomboval)

$combo = GUICtrlCreateCombo("",10,10,150,100)
GUICtrlSetData(-1,$precomboval)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then ExitLoop
    If $msg = $combo Then Msgbox(0,"Item selected:",StringReplace(GUICtrlRead($combo)," I ","|"))
WEnd
Edited by Holger
Link to comment
Share on other sites

That's not the same : | - I

I tried || but that doesn't work. The only way if you have ONLY ONE ITEM with a pipe character is to place it in the GUICtrlCreateCombo first parameter

<{POST_SNAPBACK}>

Lowercase "L" | (pipe) = l ("L")

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

|| is an empty selection. It cannot have a double meaning. It is not possible?

Edit: I was going to mention, use semi-colons, to replace pipes in source, but the 1st post example is using special characters. How do you fix that? one way or another, impossible to cover, every scenerio?

Not too many OS commands use semi-colons much though, if that is the direction, for a new separator.

Edited by MHz
Link to comment
Share on other sites

There should either be user-defineable seperators or there should be a way to escape the hard-coded seperator. We can't just simply forbid a particular character because we want to use it as a delimiter. Switching to some other character as a seperator is just skirting the real issue.

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