Xojo Conferences
MBSOct2019CologneDE

Control the appearance of EditFields in ListBoxes (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: WWDC Conferences
Next thread: Determining number of files in a given folder/disk.


Re: EditFields in ListBoxes   -   Will Leshner
  Control the appearance of EditFields in ListBoxes   -   Marco Bambini
   Re: Control the appearance of EditFields in ListBoxes   -   Andrea Suraci
    Re: Control the appearance of EditFields in ListBoxes   -   Francois Van Lerberghe
    Re: Control the appearance of EditFields in ListBoxes   -   Francois Van Lerberghe
   Re: Control the appearance of EditFields in ListBoxes   -   Will Leshner
   Re: Control the appearance of EditFields in ListBoxes   -   Joel Rosenblum
    Re: Control the appearance of EditFields in ListBoxes   -   Andrea Suraci

Control the appearance of EditFields in ListBoxes
Date: 08.05.02 06:48 (Wed, 8 May 2002 07:48:43 +0200)
From: Marco Bambini
My problem is how to set the width and alignment properties of an
EditField cell in a ListBoxe.
If I have a simple EditField I can set its properties using a syntax
like;

dim t as EditField

t.width50
t.alignment
But how can I set this properties in a cell? I have tried something like:

dim t as EditField

t=myList.Cell(1,2)
t.width50
t.alignment
but it doesn't works.

Please help me...

Regards,
Marco Bambini

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Control the appearance of EditFields in ListBoxes
Date: 08.05.02 09:15 (Wed, 8 May 2002 10:15:00 +0200)
From: Andrea Suraci

Wednesday, May 8, 2002, alle 07:48 am, Marco Bambini ha scritto:

> My problem is how to set the width and alignment properties of an
> EditField cell in a ListBoxe.

You can't have an EditField in a ListBox (not unless you actually place
it inside a listbox): they are quite different things.
A listbox can have inline editable cells that act like an editfield, but
they are not editfields.

> But how can I set this properties in a cell? I have tried something
> like:
>
> dim t as EditField
>
> t=myList.Cell(1,2)
> t.width50
> t.alignment >
> but it doesn't works.

That's because cell(row,column) is a function of the listbox control,
not a control itself.

>
> Please help me...

If you want an editable cell to draw aligned text, you could set its
celltype0only when you click on it.
In the Open Event of the listBox set the cell or column alignment you
want, then switch a cell to editable in the CellClick event

Function CellClick(row as Integer, column as Integer, x as Integer, y as
Integer) As Boolean
if columnthen//your conditions, if needed
me.cellType(row,column)0/inline editable
end if
End Function

When you leave the cell cellAction Event fires.

Sub CellAction(row As Integer, column As Integer)
me.cellType(row,column)/set cell to default (aligned) state
End Sub

Another solution would be to have an invisible editfield pop up over the
current cell: this way you can control its size too.
Something like (not tested)

Function CellClick(row as Integer, column as Integer, x as Integer, y as
Integer) As Boolean
EditField1.left=me.left
EditField1.top = me.top+me.defaultRowHeight*(row-me.scrollPosition)
EditField1.width = me.width
EditField1.text = me.cell(row,column)
EditField1.visible = true
End Function

HTH,
Andrea

"Success usually comes to those who are too busy to be looking for it."
-Henry David Thoreau

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Control the appearance of EditFields in ListBoxes
Date: 09.05.02 09:28 (Thu, 09 May 2002 10:28:40 +0200)
From: Francois Van Lerberghe
Andrea Suraci wrote :
>
> Another solution would be to have an invisible editfield pop up over the
> current cell: this way you can control its size too.
> Something like (not tested)
>
> Function CellClick(row as Integer, column as Integer, x as Integer, y as
> Integer) As Boolean
> EditField1.left=me.left
> EditField1.top = me.top+me.defaultRowHeight*(row-me.scrollPosition)
> EditField1.width = me.width
> EditField1.text = me.cell(row,column)
> EditField1.visible = true
> End Function

I think this solution is more powerfull than using Listbox.ActiveCell
because you can control completely the behavior of the EditField. You
can even use different subclasses of it for different columns (using
more than one editfield in that case). You can also extend this to other
control such as popup menu, checkbox, ...
I use it in many places.

Unfortunately, this doesn't work in Windows with RB 4.0 and greater
because the ListBbox "paint" (?) event erase completely any control in
front of it. (No problem in MacOS thought)
This bug (I consider so) has forced us to come back to RB 3.5
I encourage everybody concerned with this to realbug this annoying (show
stopper) behavior under Windows OS.

François Van Lerberghe
Thier Monty, 15A
B-4570 Marchin
Belgique

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Control the appearance of EditFields in ListBoxes
Date: 10.05.02 18:00 (Fri, 10 May 2002 19:00:37 +0200)
From: Francois Van Lerberghe
Andrea Suraci wrote :
>
> Another solution would be to have an invisible editfield pop up over the
> current cell: this way you can control its size too.
> Something like (not tested)
>
> Function CellClick(row as Integer, column as Integer, x as Integer, y as
> Integer) As Boolean
> EditField1.left=me.left
> EditField1.top = me.top+me.defaultRowHeight*(row-me.scrollPosition)
> EditField1.width = me.width
> EditField1.text = me.cell(row,column)
> EditField1.visible = true
> End Function

I think this solution is more powerfull than using Listbox.ActiveCell
because you can control completely the behavior of the EditField. You
can even use different subclasses of it for different columns (using
more than one editfield in that case). You can also extend this to other
control such as popup menu, checkbox, ...
I use it in many places.

Unfortunately, this doesn't work in Windows with RB 4.0 and greater
because the ListBbox "paint" (?) event erase completely any control in
front of it. (No problem in MacOS thought)
This bug (I consider so) has forced us to come back to RB 3.5
I encourage everybody concerned with this to realbug this annoying (show
stopper) behavior under Windows OS.

François Van Lerberghe
Thier Monty, 15A
B-4570 Marchin
Belgique

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Control the appearance of EditFields in ListBoxes
Date: 08.05.02 15:55 (Wed, 8 May 2002 07:55:16 -0700)
From: Will Leshner
You use the ActiveCell property of the ListBox:

listbox.ActiveCell.alignment = 2

But I'm seeing a number of problems when I try it myself. First, of
course, there's no way to set the properties on a cell-by-cell basis.
There is only one editfield for the entire listbox. Also, if you set the
alignment, say, of the activecell to 2 (centered), you won't get
centered text in your cells. You also need to set the alignment of your
cells or columns in the listbox:

listbox.ColumnAlignemnt(0) = 2

That will give column 0 center alignment. But apparently you cannot
center align a listbox if you are also doing inline editing. So if you
do this:

listbox.ColumnType(0) = 3 // inline editing
listbox.ColumnAlignment(0) = 2 // center alignment

you won't get center-aligned cells. And, to make matters worse, if you
center-align the active cell:

listbox.ActiveCell.alignment = 2

then when you edit your cell the text disappears from the cell. But, you
do get center alignment for the text you enter.

On Tuesday, May 7, 2002, at 10:48 PM, Marco Bambini wrote:

> My problem is how to set the width and alignment properties of an
> EditField cell in a ListBoxe.
> If I have a simple EditField I can set its properties using a syntax
> like;
>
> dim t as EditField
>
> t.width50
> t.alignment >
> But how can I set this properties in a cell? I have tried something
> like:
>
> dim t as EditField
>
> t=myList.Cell(1,2)
> t.width50
> t.alignment >
> but it doesn't works.
>
> Please help me...
>
> Regards,
> Marco Bambini
>
> ---
> Subscribe to the digest: <mailto:realbasic-nug-
> <email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Control the appearance of EditFields in ListBoxes
Date: 08.05.02 18:38 (Wed, 8 May 2002 13:38:24 -0400)
From: Joel Rosenblum
>> My problem is how to set the width and alignment properties of an
>> EditField cell in a ListBoxe.
>
> You can't have an EditField in a ListBox (not unless you actually place
> it inside a listbox): they are quite different things.
> A listbox can have inline editable cells that act like an editfield, but
> they are not editfields.

Yes they are. Listbox.ActiveCell is what you need to look at (4.0 and
up).

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Control the appearance of EditFields in ListBoxes
Date: 08.05.02 19:07 (Wed, 8 May 2002 20:07:44 +0200)
From: Andrea Suraci

Wednesday, May 8, 2002, alle 07:38 pm, Joel Rosenblum ha scritto:

> Yes they are. Listbox.ActiveCell is what you need to look at (4.0 and
> up).

D'oh! How did I miss that? thank you very much for pointing this out
(and sorry for my wrong statements).

Andrea (/w,/as).
=#D#D#D#DkDwD;D/DoDgDgDsDkDkDkDoDwDDkDoD"Never trust a computer you can't throw out a window."
-Steve Wozniak

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>