EIP Drop List - Align left when drop width > column width

For an EIP Drop List, I often increase the drop width from the width of the list column.
This is easily done in the EIP Init method (after Parent) using:
SELF.Feq{PROP:DropWidth} = mywidth#

When embedded, the wide drop list itself stays right aligned with the column. This default is usually desired.

However, in order to to left align the drop list with the column, I tried the following:
DropListPartFeq# = SELF.Feq{PROP:ListFeq}
DropListPartFeq#{PROP:XPos} = MyColXPos#
Unfortunately, this does not change the results.

Any ideas?

I think for that to work you need to use EVENT:DroppingDown. I also think the coordinates are screen based (and in pixels), but I’m not 100% sure. I seem to remember having to set both X and Y positions after using GetWindowRect() to get the coordinates.

Something like that.

This works, but haven’t tried it on an EIP.
NOTE: I don’t know if this is C11 specific, but it’s quirky as heck when setting and getting the positions. See what I mean in the comments in the code. Any other combinations of getting/setting positions were pretty whacked out.

 PROGRAM

POINT GROUP,TYPE
X       LONG
Y       LONG
       END

ListFEQ  LONG  
MyPoints LIKE(POINT)
HWND     EQUATE(ULONG)
 
   MAP
     MODULE('')
       ClientToScreen(HWND hWnd, *POINT lpPOINT),bool,raw,pascal,proc
     END
   END
   
Window WINDOW('Caption'),AT(,,395,224),GRAY,FONT('Segoe UI',9)
    LIST,AT(8,8,,15),USE(?MyDropList),DROP(3),FROM('X|Y|Z')
  END
  
  CODE
  
  OPEN(Window)
  ListFEQ = ?MyDropList{PROP:ListFEQ}
  0{PROP:Pixels} = TRUE
  ACCEPT
    CASE FIELD()
    OF ?MyDropList
      CASE EVENT()
      OF EVENT:DroppingDown
        GETPOSITION(ListFEQ,MyPoints.X,MyPoints.Y) 
        ClientToScreen(0{PROP:Handle},MyPoints)
        MyPoints.X += 20
        !ListFEQ{PROP:XPos} = MyPoints.X  <--- DO NOT USE - Use SETPOSITION instead
        !ListFEQ{PROP:YPos} = MyPoints.Y  <----DO NOT USE - Use SETPOSITION instead
        SETPOSITION(ListFEQ,MyPoints.X,MyPoints.Y)
      END
    END
  END

Try this code, inspired or based on a post by @jslarve

Have not yet gone through Carl’s code looking for differences. However, the one issue I see with EIP is that ListFEQ has already been displayed in the default position when EVENT:DroppingDown code is run. Not the smoothest, but perhaps acceptable to me.

In a derived EditDropListClass or EditDropComboClass, the behaviour will be determined by a single AlignLeft property that can be set in the Init method.

I’m pretty sure mine is not quirky nor whacked out. There is a test program to try out any variation.

1 Like

My derived EditDropListClass is thankful to you both, however quirky & whacked one might consider the examples.