Author Topic: [4857Win] List Control for FontLab Dialogs broken  (Read 966 times)

Eigi

  • Beta: FontLab Studio Mac
  • Hero Member
  • ***
  • Posts: 100
    • e-font
[4857Win] List Control for FontLab Dialogs broken
« on: 2013-04-30, 04:33:31 »
Hello,

given the folowing code:
Code: [Select]
from FL import *

class ListTestDlg(object):
def __init__(self):
self.d = Dialog(self)
self.d.size = Point(200, 200)
self.d.Center()
self.d.title = 'List Control Test'
listRect = Rect(20, 20, 180, 160)
self.d.AddControl(LISTCONTROL, listRect, 'testListCtrl', STYLE_LIST)
self.testListCtrl = ['Item 0', 'Item 1', 'Item 2', 'Item 3', 'Item 4']
self.testListCtrl_index = 0

def on_testListCtrl(self, code):
self.d.GetValue("testListCtrl")
print 'ListItem index %d clicked' % self.testListCtrl_index

def Run(self):
return self.d.Run()

dlg = ListTestDlg()
if dlg.Run() == OK:
print 'Dialog closed with OK: ListItem index %d selected' % dlg.testListCtrl_index
You will get the folowing dialog

When you use this dialog in FontLab 5.0.4 build 2741 and click on the topmost list item you will get 0 as index, 1 for the second and so on - business as usual.

If you do the same in FontLab 5.2.1 build 4857 you get -1 as index for the topmost item, 0 for the second, 1 for the third and so on.

This means all existing scripts which use the list control in FontLab dialogs are now broken.

This problem seems to be related with:
http://forum.fontlab.com/index.php?topic=8805.0

Best
Eigi