Listbox: no CueText in an EditableTextField Cell ?

In a Listbox: I was able to set a Mask for an Editable Cell (read below)

Me.ActiveCell.Mask = "##-##-####"

But I do not found the CueText Property (to say “DD-MM-YYYY“).

An error here or that property is not available at ListBox Cell Edit time ?

You could “fake” a cue text by"drawing" the text in then TextPaint event.

  • create a subclass of a listbox
  • add an array property named CueText() as String.
  • add an event handler for CellTextPaint in your subclass, and use the following code in that event handler:

if me.Cell( row, column ) = "" and column <= Cuetext.Ubound then g.ForeColor = &cAAAAAA g.Italic = true g.DrawString Cuetext( column ), x, y end if

Each element in the CueText array contains the value for the column. So, in the open event of the listbox you could do something like this:

me.Cuetext.Append "DD-MM-YYYY" me.Cuetext.Append "username" me.Cuetext.Append "password"

Of course, there are so many ways of faking the cuetext.
If you want cell-specific cuetext values, you could store the cuetext in the celltag.

And yes, I know… it would be nice to have something like this as a build in feature.

[quote=351001:@Emile Schwarz]In a Listbox: I was able to set a Mask for an Editable Cell (read below)

Me.ActiveCell.Mask = "##-##-####"

But I do not found the CueText Property (to say “DD-MM-YYYY“).

An error here or that property is not available at ListBox Cell Edit time ?[/quote]
You’ve got to cast it:

TextField(me.activeCell).cueText = “DD-MM-YYYY”

Greg, you are the Forum Hero of the day!
handing over a big trophy

Works better for Emile than my bulky solution. Thanks!

[quote=351013:@Edwin van den Akker]Greg, you are the Forum Hero of the day!
handing over a big trophy

Works better for Emile than my bulky solution. Thanks![/quote]
You probably should test with IsA before doing that as you’ll get an error if your listbox uses TextAreas instead of TextFields.

Greg: works fine. Exactly what I wanted !

I used:

Me.ColumnType(1) = ListBox.TypeEditableTextField

So, I do not have to use ISA.

Many, many thanks !

Edit: some days ago someone asked something related to Listbox that leads me to what I’ve done today: use a mask and a CueText in a Listbox (2) Columns where a user will enter two dates (because of the cultural differences on it AND the user propension to do what (s)he want, not always what the software expect.

Why not use a date picker instead?

One more thank.

In that window (a simple window that allow the company manager to deal with absent employees); I have a button that adds an empty Row (to add a new absent employee).

Now, when a click is done in the Add PushButton):
a. I add a new Row,
b. I set that Row’s Cell(0) as Edit (the Text cursor appears),
c. I add a Cue Text to tell the manager what to wrote in that Cell.

Easier than that is nearly impossible to build in the software (or I will live there and do the job by myself) :wink:

I even automatized the Export function: no used dialog ! The manager only have to click in the Export button and the file goes directly in its correct location.