Hi,
I have written about this issue in the past in several different forms - 
posts.  Today I decided to give it another go at attempting to find the issue 
over this weekend.  But before I get started I thought I'd ask the list for 
their thoughts on an insight I believe I've come to understand.


Every time I add a dropdown to my forms - performance drops.  The form opens 
slower and the general response to using the dropdowns is really noticeable 
(none of this applies to windows).  Below is how I normally setup my 
dropdowns.

I hand code my forms.  And in the afterInit I will setup the dropdown as 
follows:

pccodechoices,pccodekeys= self.Form.penalcodeChoices()
        pclist=dabo.ui.dDropdownList(self, Name = 'pccodeChoices',ValueMode = 
'key', RegID = 'pccodeID', Choices = pccodechoices, Keys = pccodekeys, 
DataSource = "public.esenroll", DataField = "fk_pccode")

<b>OR</b>

courtlist=CourtDropDown(self, ValueMode = 'key', RegID = 'courtID', DataSource 
= "public.esenroll", DataField = "fk_escourts")

courtlist.bindEvent(dabo.dEvents.Hit, self._courtChange)

Where CourtDropDown is a class 
class CourtDropDown(dabo.ui.dDropdownList):
    def update(self):
        self.removeAll()
        self.Choices,self.Keys = self.Form.courtChoices()
        self.super()

The routine to set the Choices and Keys is normally as follows and is in the 
MainForm class:

def courtChoices(self):
        courtDS = self.escourts.getDataSet()
        availableChoices=['<None>']
        keyChoices=[0]
        for row in courtDS:
            availableChoices.append(row['court_name'])
            keyChoices.append(row['pkid'])
        return availableChoices,keyChoices


<b>OR</b>

def penalcodeChoices(self, pcstate = None, statechar = None):
        localTempCur = self.PrimaryBizobj.getTempCursor()
        
        if pcstate and statechar is None:
            localTempCur.execute("select state_1 from escourts where pkid  = 
%s" % (pcstate))
            self.pc_stateID.Value = localTempCur.Record.state_1
            localTempCur.execute("Select pkid, ccode, cdescript, state_1 from 
public.pc_code where state_1 = '%s'" % (localTempCur.Record.state_1))
        elif statechar and pcstate is None:
            localTempCur.execute("Select pkid, ccode, cdescript, state_1 from 
public.pc_code where state_1 = '%s'" % (statechar))
        else:
            localTempCur.execute("Select pkid, ccode, cdescript, state_1 from 
public.pc_code")
        penalDS = localTempCur.getDataSet()
        #penalDS = self.miscBizobj.getDataSet()
        availableChoices=['<None>']
        keyChoices=[0]
        for row in penalDS:
            pc = row['ccode'] +', ' + row['state_1']
            availableChoices.append(pc)
            keyChoices.append(row['pkid'])

        return availableChoices,keyChoices


On the windows platform I see little change in performance as I add dropdowns 
to the code.  But on Linux I see major issues with the performance of the 
dropdowns.  They take as much as a full minute (sometimes much longer) to 
allow selection of the choices/items.  Please do not misinterpret me - the 
code on Linux works but very very slowly.

My question:

Reviewing my code - is there a better way of providing the choices and keys 
for a dropdown?  Most of the dropdowns require that I change the Choices, Keys 
in some dynamic way to match the needs of the user at the time of data entry.  
Although, I do have a few static dropdowns.  I know for a fact that the access 
to the data is very fast (less than a few ms per request) and therefore not 
the reason the dropdowns take so long to respond.  Also note that the same 
data access occurs for the windows platform and there are no performance 
issues.

Please note that I require the Choice = None and the Key = 0 due to creating a 
new record (data entry) and the dropdown control points to a None value after 
creating a new record.

Any thoughts would be helpful.  

Johnf






_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to