Paradox Community

Items in pnews.paradox-programming

Subject:Re: PopUpMenu exceeds the limit
Date:Wed, 8 Aug 2018 11:01:02 -0500
From:Mark Bannister <markRemove@THISinjection-moldings.com>
Newsgroups:pnews.paradox-programming
I'm hijacking your thread now that it looks like you have some answers. 
I use complicated pop up menus.  They are awkward and annoying to use. 
But they are quick and dirty to write and easy to reuse code.

What are some better options?  I have a custom menu which uses icons I 
use but for many things there are no obvious icons that make sense (and 
good grief it can take longer to find something vaguely relevant than it 
does to write the code). As well as the fact that I often have 
sub-sub-sub options which doesn't work well on an icon/menu bar.

For picking things from long lists I use a form that pops up (acts much 
like a drop down menu from a field).








On 8/7/2018 4:23 AM, Thies Grimm wrote:
> Hi there
> 
> I want to build a user Select via PopUpMenu
> 
> for example I read some data in a TCursor and let the user choose as many
> values as he or she wants to choose.
> 
> 
> so far everything works as desired.
> 
> after about 10 choices I get an error
> 
> The number of menu items has exceeded the limit set
> p.addText(tc.(2), tc.(3))
> 
> Why? It works about 10 times, I empty the popUpMenu,
> the menuSetLimit is set to 254. So what is wrong?
> 
> 
> you might check it on your PC, creating a new script and paste the code.
> 
> Read it before you start it. :-)
> 
> There are to procs and one method
> 
> Thanks in advance
> 
> Thies
> 
> 
> 
> 
> proc cpUserSelect(
>              stTitle String,
>              var tc TCursor
>              )Logical
> var
>     pnt               Point
>     p                  popUpMenu
>     stChoice            String
> endVar
> 
>     pnt = Point(1440,1440)
> 
>     tc.edit()
> 
> ; //	let the user choose as long as he or she wants tos do so
> ; //	stop it, using okay, cancel ...
> ; //
>     while 2> 1
>        p.unassign()
>        cpBuildPopUp(tc, p)
> 
>        stChoice = p.show(pnt.X(), pnt.Y())
> 
>        switch
>           case stChoice = "Okay":       return True
>           case stChoice = "Cancel":     errorLog(UserError, "Cancel")
>                                         return False
>           case stChoice.isblank():      errorLog(UserError, "No Choice")
>                                         return False
>           case tc.locate(2, stChoice):  if tc.(3) = MenuChecked then
>                                            tc.(3) = MenuNotChecked
>                                         else
>                                            tc.(3) = MenuChecked
>                                         endIf
>                                         tc.unlockRecord()
>           otherWise:                    errorLog(UserError, "nn error")
>                                         return False
>        endSwitch
>     endWhile
> 
>     tc.endEdit()
> 
>     return True
> 
> endProc
> 
> proc cpBuildPopUp(
>              var tc TCursor,
>              var p PopUpMenu
>              )Logical
> var
>     si                  SmallInt
> endVar
> 
>     menuSetLimit(254)
> 
>     p.empty()
>     si = 0
> 
> ; //	having a break every 40 lines
>     scan tc:
>        if si.mod(40) = 0 then
>           p.addBreak()
>           si = 0
>        endIf
>        si = si + 1
> 
>        p.addText(tc.(2), tc.(3))
> 
>     endScan
> 
> ; //	adding Okay and Cancel
>     p.addSeparator()
>     p.addText("Okay")
>     p.addText("Abbrechen")
>     
> 
>     return True
> endProc
> 
> method run(var eventInfo Event)
> var
>     tc                  TCursor
>     db                  DataBase
>     itemSQL             SQL
>     li                  LongInt
> endVar
> 
> ; //	create some test data ==> tc
> 
>     enumRTLConstants(":priv:__tblRTLConstants.db")
> 
>     db.open("priv")
>     li = MenuChecked
>     itemSQL =
>        SQL
>           SELECT GroupName, ConstantName, ~li AS Choice
>           FROM '__tblRTLConstants.db'
>           WHERE GroupName like 'A%'
>        endSQL
>     itemSQL.wantInMemoryTCursor(Yes)
>     if not itemSQL.executeSQL(db, tc) then
>        errorShow()
>        return
>     endIf
> 
> ; //	ask the user
>     if not cpUserSelect("RTLConstants", tc) then
>        errorshow()
>        return
>     endIf
> 
> ; //	if succes ==>
>     tc.instantiateView(":priv:__tblRTLConstantsChoice.db")
>     tc.close()
> 
> endMethod
> 
> 
> 
> 
> 


Copyright © 2004 thedbcommunity.com