Autor Tema: Leandro ListBoEx Help  (Leído 6119 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Gianni

  • Bytes
  • *
  • Mensajes: 28
  • Reputación: +0/-0
    • Ver Perfil
Leandro ListBoEx Help
« en: Marzo 14, 2010, 03:00:18 pm »
Hi to all and sorry for my English.

I found 2 problems with the use of ListBoxEX:

1) when you use ScrollStyle = UpDownButton and click over a scroll button (up or down)
   You can no longer scroll the list.
   Only if you use the mouse wheel or if the control loses focus you can scroll again the list.
   For reproduce this click over the scroll button before click in the ListBox.

2) when you use ScrollStyle =ScrollBar and you click over the scrollbar arrow,
    I see a random selection appear on the list elements.
     Also the list is not scrolled properly.
    For reproduce add iItem to ListBox using 0 as icon Index for all item

Please, can someone help me solve this problem?

The icons (also Using 32bit icons) are drawed without alpha channel.
How to fix this? how to improve quality of the icons?

Thanks for any help

Regards
Gianni
« última modificación: Marzo 14, 2010, 03:22:09 pm por Gianni »

coco

  • Administrador
  • Terabyte
  • *****
  • Mensajes: 548
  • Reputación: +63/-3
    • Ver Perfil
Re:Leandro ListBoEx Help
« Respuesta #1 en: Marzo 14, 2010, 03:36:54 pm »
Hi to all and sorry for my English.

I found 2 problems with the use of ListBoxEX:

1) when you use ScrollStyle = UpDownButton and click over a scroll button (up or down)
   You can no longer scroll the list.
   Only if you use the mouse wheel or if the control loses focus you can scroll again the list.
   For reproduce this click over the scroll button before click in the ListBox.

Well Gianni, I see what you mean. To fix that, you must change some code. In first place, you must change the following line:
Código: (vb) [Seleccionar]
Private Sub PicScroll_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim PT As POINTAPI
    Dim ScrollVelociti As Long
    Static IsIn As Boolean 'delete this line.
    ...
After that, you need to add this to the top of the file:
Código: (vb) [Seleccionar]
....
Dim InProcessMSG                As Boolean
Dim mSelectionWidth             As Long
Dim IsIn                        As Boolean 'Add this
...

Now, edit the following function "GetHitTest"
Código: (vb) [Seleccionar]
...
        If PT.x > AreaItem And PT.x < AreaItem + mSelectionWidth Then
            GetHitTest = (PT.y + TopPos) \ mItemHeight
        Else
            GetHitTest = -1
        End If
...
Edit that:
Código: (vb) [Seleccionar]
...
        If PT.x > AreaItem And PT.x < AreaItem + mSelectionWidth Then
            If Not IsIn Then
                GetHitTest = (PT.y + TopPos) \ mItemHeight
            Else
                GetHitTest = -1
            End If
        Else
            GetHitTest = -1
        End If
...
And for last, add this sub:
Código: (vb) [Seleccionar]
Private Sub PicScroll_Click(Index As Integer)
    IsIn = False
    Call PicScroll_MouseMove(Index, 0, 0, 0, 0)
End Sub

And well, for me it's fixed. Tell me later if it's working.


2) when you use ScrollStyle =ScrollBar and you click over the scrollbar arrow,
    I see a random selection appear on the list elements.
     Also the list is not scrolled properly.
    For reproduce add iItem to ListBox using 0 as icon Index for all item
I've tryed that, but.. I can't see what you're saying. Sorry.

Regards, cocus
« última modificación: Marzo 14, 2010, 03:41:48 pm por coco »
'-     coco
(No me cabe: Java, Python ni Pascal)
SQLite - PIC 16F y 18F - ARM STM32 - ESP32 - Linux Embebido - VB6 - Electronica - Sonido y Ambientacion

cobein

  • Moderador Global
  • Gigabyte
  • *****
  • Mensajes: 348
  • Reputación: +63/-0
  • Más Argentino que el morcipan
    • Ver Perfil
Re:Leandro ListBoEx Help
« Respuesta #2 en: Marzo 14, 2010, 03:49:19 pm »

Advertencia - mientras estabas escribiendo, una nueva respuesta fue publicada. Probablemente desees revisar tu mensaje.

The alpha on the icons is fixed once you compile and add a manifest to the file, or alternatively you can change the drawing function to see the results in the IDE. About the scrolls, well I'll let LeandroA answer that since im not familiar with the control.

coco

  • Administrador
  • Terabyte
  • *****
  • Mensajes: 548
  • Reputación: +63/-3
    • Ver Perfil
Re:Leandro ListBoEx Help
« Respuesta #3 en: Marzo 14, 2010, 03:53:58 pm »

Advertencia - mientras estabas escribiendo, una nueva respuesta fue publicada. Probablemente desees revisar tu mensaje.

The alpha on the icons is fixed once you compile and add a manifest to the file, or alternatively you can change the drawing function to see the results in the IDE. About the scrolls, well I'll let LeandroA answer that since im not familiar with the control.

I'm not sure, but I think that the method of loading file and then adding to the image list, provides alpha channel. I'm only thinking on the manifest. He can use your Add Manifest to the VB6.exe, or put a vb6.exe.manifest in the vb6 path.
'-     coco
(No me cabe: Java, Python ni Pascal)
SQLite - PIC 16F y 18F - ARM STM32 - ESP32 - Linux Embebido - VB6 - Electronica - Sonido y Ambientacion

Gianni

  • Bytes
  • *
  • Mensajes: 28
  • Reputación: +0/-0
    • Ver Perfil
Re:Leandro ListBoEx Help
« Respuesta #4 en: Marzo 18, 2010, 05:35:37 am »
Hi to all and thanks for help me.

Thanks Leandro now  the first problem is gone.

For the second problem:
I tried to reproduce the problem using your demo project.
In Form Load modify your code :

Código: [Seleccionar]
'----------------------------------Ejemplo2
    With ListBoxEx2
        .IconsSize = 48
        For i = 0 To 7
            .ImageListLoadIconFromFile App.Path & "\Iconos\" & i & ".ico"
        Next
       
        .AddItems "Cámara Fotográfica", 0
        .AddItems "Celular", 1
        .AddItems "Monitor", 2
        .AddItems "Juegos", 3
        .AddItems "Papelera de reciclaje", 4
        .AddItems "Auriculares", 5
        .AddItems "Batería", 6
        .AddItems "Reloj", 7
        .AddItems "Cámara Fotográfica", 0
        .AddItems "Celular", 1
        .AddItems "Monitor", 2
        .AddItems "Juegos", 3
        .AddItems "Papelera de reciclaje", 4
        .AddItems "Auriculares", 5
        .AddItems "Batería", 6
        .AddItems "Reloj", 7
       
        .ScrollStyle = ScrollBar
        .IconAlign = AlingLeft
        .SelectedIndex = 1
    End With

With these changes I am having the problem.

For Alpha Channel Icons:
my fault, sorry  the manifest was missing.
It's possible add PNG instead of 32bit icons?

Thanks again for Help
« última modificación: Marzo 18, 2010, 01:09:44 pm por Gianni »

coco

  • Administrador
  • Terabyte
  • *****
  • Mensajes: 548
  • Reputación: +63/-3
    • Ver Perfil
Re:Leandro ListBoEx Help
« Respuesta #5 en: Marzo 18, 2010, 02:18:51 pm »
Hi to all and thanks for help me.

Thanks Leandro now  the first problem is gone.

For the second problem:
I tried to reproduce the problem using your demo project.
In Form Load modify your code :

Código: [Seleccionar]
'----------------------------------Ejemplo2
    With ListBoxEx2
        .IconsSize = 48
        For i = 0 To 7
            .ImageListLoadIconFromFile App.Path & "\Iconos\" & i & ".ico"
        Next
       
        .AddItems "Cámara Fotográfica", 0
        .AddItems "Celular", 1
        .AddItems "Monitor", 2
        .AddItems "Juegos", 3
        .AddItems "Papelera de reciclaje", 4
        .AddItems "Auriculares", 5
        .AddItems "Batería", 6
        .AddItems "Reloj", 7
        .AddItems "Cámara Fotográfica", 0
        .AddItems "Celular", 1
        .AddItems "Monitor", 2
        .AddItems "Juegos", 3
        .AddItems "Papelera de reciclaje", 4
        .AddItems "Auriculares", 5
        .AddItems "Batería", 6
        .AddItems "Reloj", 7
       
        .ScrollStyle = ScrollBar
        .IconAlign = AlingLeft
        .SelectedIndex = 1
    End With

With these changes I am having the problem.

For Alpha Channel Icons:
my fault, sorry  the manifest was missing.
It's possible add PNG instead of 32bit icons?

Thanks again for Help

Maybe, but I like to use ICONs with ALPHA CHANNEL and 32bits, exactly the same as PNGs. Anyway, it's possible adapting some code from this project: INSERTAR IMÁGENES PNG EN UN IMAGELIST (Insert png images to ImageList) because the ListBox uses ImageList.

Bye
'-     coco
(No me cabe: Java, Python ni Pascal)
SQLite - PIC 16F y 18F - ARM STM32 - ESP32 - Linux Embebido - VB6 - Electronica - Sonido y Ambientacion

Gianni

  • Bytes
  • *
  • Mensajes: 28
  • Reputación: +0/-0
    • Ver Perfil
Re:Leandro ListBoEx Help
« Respuesta #6 en: Marzo 23, 2010, 03:32:57 pm »
Hi to all and sorry for disturb again.
I have found a bug in ListBoxEx - in Sub Sorted.

If you add Items with uppercase letter the "Sub Sorted" sort the items,
but if you add Items with lowercase letter the "Sub Sorted" Fail to sort items.

Try: (fail)
Código: [Seleccionar]
Private Sub Command6_Click()
ListBoxEx2.AddItems "ape", 0
ListBoxEx2.Sorted AcendetOrder
End Sub

If you use "Ape" or "APE" you have Items sorted.

I have modified Sub Sort:

Código: [Seleccionar]
If Item(i).Caption > Item(i + 1).Caption Thenwith
Código: [Seleccionar]
If UCase(Item(i).Caption )> UCase(Item(i + 1).Caption) Thenand this works.

It's correct or there is a better method?

Thanks for any help
« última modificación: Marzo 23, 2010, 04:02:17 pm por Gianni »