Re: Popup Button bug??

2025-01-28 Thread Craig Newman via use-livecode
Did you try my stack? It does not use a button at all for the menuItem list, 
rather a field. Looks the same, much easier to manage.

Craig

> On Jan 27, 2025, at 4:18 PM, Bob Sneidar via use-livecode 
>  wrote:
> 
> Not at all. I have a File Server Agent that uses socket communications. I 
> first get a list of files from the user, then I query the server or a list of 
> what I call Profiles which right now are just a name and a file path on the 
> server. 
> 
> I want to present the client user with a list of the names of those profiles. 
> If the user does not select a profile, either by clicking off the menu I pop 
> up, or by hitting the escape key, then I notify the user that they must 
> choose a profile. 
> 
> If they do choose a profile then I send the server an array with some 
> key/values, and the file data is stored in a numbered array in the data key. 
> Each key in the data keys is first encrypted, then tho whole of the array is 
> arrayEncoded, then base 64Encoded before opening a socket and sending the 
> data. 
> 
> I tried using the popup menu button but that will not work unless the popup 
> button command is called from a mouseDown or mouseUp handler. I am making the 
> call from a behavior script which is why I was getting the error. And 
> besides, you can’t control the popup menu’s appearance, whereas with a field 
> you can. Also I am anticipating having more values than can be entirely 
> displayed by a popup menu without running out of screen real estate, so a 
> scrolling field works much better. 
> 
> I’m curious how you would do that with native controls? 
> 
> Bob S
> 
> 
>> On Jan 27, 2025, at 12:27 PM, Craig Newman via use-livecode 
>>  wrote:
>> 
>> Bob.
>> 
>> What are you trying to accomplish that the native buttons do not do for you? 
>> The popUp command, to me, is simply a tool to invoke a display of resident 
>> menuItems that do not necessarily have to live at the button location 
>> itself, and that button not even needing to be visible.
>> 
>> Are you adding a lot of additional gadgetry?
>> 
>> Craig
>> 
>>> On Jan 27, 2025, at 2:01 PM, Bob Sneidar via use-livecode 
>>>  wrote:
>>> 
>>> Interesting, the dictionary didn’t mention mouseUp. But some kind of mouse 
>>> up or down handler has to be what makes the call. 
>>> 
>>> It turns out that rolling your own blocking popup “menu” is not very 
>>> straightforward. Here is what I came up with: 
>>> 
>>> on popupMenu pMenu, pItems, pLocation
>>> -- anything less than 3 lines and the scrollbar does not display correctly
>>> if the number of lines of pItems >3 and \
>>>   the last char pItems is cr then \
>>>   delete last char of pItems
>>> 
>>> set the text of pMenu to pItems
>>> set the height of pMenu to \
>>>   min(the formattedHeight of pMenu, 178) — for me 178 is 10 lines of 
>>> formattedText YMMV
>>> set the width of pMenu to the formattedWidth of pMenu
>>> set the topLeft of pMenu to pLocation
>>> show pMenu 
>>> focus on pMenu
>>> set the hilitedLine of pMenu to empty -- because focus will auto-select 
>>> line 1
>>> wait until the visible of pMenu is false with messages
>>> end popupMenu
>>> 
>>> 
>>> — in the script of a Scrolling List Field
>>> local lParentCard
>>> 
>>> on selectionChanged
>>> put getParentCard(the long id of me) into lParentCard
>>> put the hilitedLine of me into tLine
>>> put line tLine of the text of me into tItem
>>> set the currentLocation of lParentCard to tItem — or whatever you want to 
>>> do with tItem
>>> hide me
>>> end selectionChanged
>>> 
>>> on escapeKey
>>> selectionChanged
>>> end escapeKey
>>> 
>>> on focusOut
>>> selectionChanged
>>> end focusOut
>>> 
>>> FUNCTION getParentCard pObjectID
>>> put offset("card id", pObjectID) into tStartChar
>>> put char tStartChar to -1 of pObjectID into tCardID
>>> return tCardID
>>> END getParentCard
>>> 
>>> Bob S
>>> 
 On Jan 27, 2025, at 9:39 AM, Craig Newman via use-livecode 
  wrote:
 
 Bob.
 
 It works just fine in a mouseUp handler as well. I just did it. 
 
 Craig
 
> On Jan 27, 2025, at 12:31 PM, Bob Sneidar via use-livecode 
>  wrote:
> 
> Understood. That is why I wrote, I assure everyone there *IS* a button 
> called “mnuLocations”. As I posted later, this command can only be used 
> in a mouseDown handler. I think I knew this many, many years ago, but I 
> forgot. 
> 
> Bob S
> 
> 
>> On Jan 27, 2025, at 9:28 AM, Craig Newman via use-livecode 
>>  wrote:
>> 
>> Bob .
>> 
>> “popup” is not a command that creates a button. It only works with an 
>> existing button, opening its contents at a location of your choice. That 
>> button can be hidden, but its menu will appear anyway.
>> 
>> Craig
>> 
>>> On Jan 27, 2025, at 12:17 PM, Bob Sneidar via use-livecode 
>>>  wrote:
>>> 
>>> Hi all. 
>>> 
>>> I have the command: 
>>> popup pMenuButton at pLocation
>>> 
>>

Re: Popup Button bug??

2025-01-28 Thread Richard Gaskin via use-livecode
Bob Sneidar wrote:
> I want to present the client user with a list of the names of those profiles.
> If the user does not select a profile, either by clicking off the menu I pop
> up, or by hitting the escape key, then I notify the user that they must
> choose a profile. 

Have you considered a list in modal dialog? 

This would allow a more spacious display for the list and the prompt, prohibit 
proceeding without the necessary selection, make that necessity clear in its 
prompt and initially-disabled confirmation button, and offer the option of 
being entirely keyboard-navigable.


But I'm also curious:

What information does the user need to consider to make that choice, and what 
would their decision tree look like?

And are some choices better than others?  Are there any that would be a "wrong" 
choice?  Any that would be a "best" choice?  What are the implications to the 
system when a suboptimal choice is made?

--
Richard Gaskin
FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Popup Button bug??

2025-01-28 Thread Bob Sneidar via use-livecode
> On Jan 28, 2025, at 2:07 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Bob Sneidar wrote:
>> I want to present the client user with a list of the names of those profiles.
>> If the user does not select a profile, either by clicking off the menu I pop
>> up, or by hitting the escape key, then I notify the user that they must
>> choose a profile. 
> 
> Have you considered a list in modal dialog? 
I have issues troubleshooting modal stacks so I avoid them if I can. 
> 
> This would allow a more spacious display for the list and the prompt, 
> prohibit proceeding without the necessary selection, make that necessity 
> clear in its prompt and initially-disabled confirmation button, and offer the 
> option of being entirely keyboard-navigable.
Good points, and the keyboard navigation part is tempting. 
> 
> 
> But I'm also curious:
> 
> What information does the user need to consider to make that choice, and what 
> would their decision tree look like?
Service technicians would store two types of documents: Data files (text files, 
address book backups, clone data etc.) and Forms (PDFs of service forms 
presented to the customer.) 

But this is the foundation to a more sophisticated document management system, 
where these storage profiles will be linked to document workflows. Things like 
Purchase Orders. AP and AR invoices, Sales Orders etc. The solution we 
currently use, Docuware that was supposed to supplant DocRecord is completely 
cloud based, and incredibly expensive, especially when we add the storage and 
extra user licenses we will need for all of our salespersons and accounting and 
executive staff. 

My ambitious goal is to create a system we control, and then if the company 
adopts it I can justify the licensing for the new LC product LC Create. But if 
I cannot demonstrate a viable product, I do not think I can sell the powers 
that be on the new licensing model. 
> 
> And are some choices better than others?  Are there any that would be a 
> "wrong" choice?  Any that would be a "best" choice?  What are the 
> implications to the system when a suboptimal choice is made?
The only suboptimal choice would be no choice. There has to be some indication 
of where the file needs to be stored on the server end. I don’t want to define 
a default because if you leave it up to end users to change the location 
profile from the default, the untrained and the unconcerned alike are just 
going to leave defaults as they are. There will be a point at which the user 
can cancel the file transfer before the payload gets sent. 

That being said, I will have to develop a mode to reassign a document in case 
of an error, and especially when the workflows begin to take shape. 
> 
> --
> Richard Gaskin
> FourthWorld.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Popup Button bug??

2025-01-28 Thread Bob Sneidar via use-livecode
Is it modal?

Bob S


> On Jan 28, 2025, at 7:07 AM, Craig Newman via use-livecode 
>  wrote:
> 
> Did you try my stack? It does not use a button at all for the menuItem list, 
> rather a field. Looks the same, much easier to manage.
> 
> Craig
> 
>> On Jan 27, 2025, at 4:18 PM, Bob Sneidar via use-livecode 
>>  wrote:
>> 
>> Not at all. I have a File Server Agent that uses socket communications. I 
>> first get a list of files from the user, then I query the server or a list 
>> of what I call Profiles which right now are just a name and a file path on 
>> the server. 
>> 
>> I want to present the client user with a list of the names of those 
>> profiles. If the user does not select a profile, either by clicking off the 
>> menu I pop up, or by hitting the escape key, then I notify the user that 
>> they must choose a profile. 
>> 
>> If they do choose a profile then I send the server an array with some 
>> key/values, and the file data is stored in a numbered array in the data key. 
>> Each key in the data keys is first encrypted, then tho whole of the array is 
>> arrayEncoded, then base 64Encoded before opening a socket and sending the 
>> data. 
>> 
>> I tried using the popup menu button but that will not work unless the popup 
>> button command is called from a mouseDown or mouseUp handler. I am making 
>> the call from a behavior script which is why I was getting the error. And 
>> besides, you can’t control the popup menu’s appearance, whereas with a field 
>> you can. Also I am anticipating having more values than can be entirely 
>> displayed by a popup menu without running out of screen real estate, so a 
>> scrolling field works much better. 
>> 
>> I’m curious how you would do that with native controls? 
>> 
>> Bob S
>> 
>> 
>>> On Jan 27, 2025, at 12:27 PM, Craig Newman via use-livecode 
>>>  wrote:
>>> 
>>> Bob.
>>> 
>>> What are you trying to accomplish that the native buttons do not do for 
>>> you? The popUp command, to me, is simply a tool to invoke a display of 
>>> resident menuItems that do not necessarily have to live at the button 
>>> location itself, and that button not even needing to be visible.
>>> 
>>> Are you adding a lot of additional gadgetry?
>>> 
>>> Craig
>>> 
 On Jan 27, 2025, at 2:01 PM, Bob Sneidar via use-livecode 
  wrote:
 
 Interesting, the dictionary didn’t mention mouseUp. But some kind of mouse 
 up or down handler has to be what makes the call. 
 
 It turns out that rolling your own blocking popup “menu” is not very 
 straightforward. Here is what I came up with: 
 
 on popupMenu pMenu, pItems, pLocation
 -- anything less than 3 lines and the scrollbar does not display correctly
 if the number of lines of pItems >3 and \
  the last char pItems is cr then \
  delete last char of pItems
 
 set the text of pMenu to pItems
 set the height of pMenu to \
  min(the formattedHeight of pMenu, 178) — for me 178 is 10 lines of 
 formattedText YMMV
 set the width of pMenu to the formattedWidth of pMenu
 set the topLeft of pMenu to pLocation
 show pMenu 
 focus on pMenu
 set the hilitedLine of pMenu to empty -- because focus will auto-select 
 line 1
 wait until the visible of pMenu is false with messages
 end popupMenu
 
 
 — in the script of a Scrolling List Field
 local lParentCard
 
 on selectionChanged
 put getParentCard(the long id of me) into lParentCard
 put the hilitedLine of me into tLine
 put line tLine of the text of me into tItem
 set the currentLocation of lParentCard to tItem — or whatever you want to 
 do with tItem
 hide me
 end selectionChanged
 
 on escapeKey
 selectionChanged
 end escapeKey
 
 on focusOut
 selectionChanged
 end focusOut
 
 FUNCTION getParentCard pObjectID
 put offset("card id", pObjectID) into tStartChar
 put char tStartChar to -1 of pObjectID into tCardID
 return tCardID
 END getParentCard
 
 Bob S
 
> On Jan 27, 2025, at 9:39 AM, Craig Newman via use-livecode 
>  wrote:
> 
> Bob.
> 
> It works just fine in a mouseUp handler as well. I just did it. 
> 
> Craig
> 
>> On Jan 27, 2025, at 12:31 PM, Bob Sneidar via use-livecode 
>>  wrote:
>> 
>> Understood. That is why I wrote, I assure everyone there *IS* a button 
>> called “mnuLocations”. As I posted later, this command can only be used 
>> in a mouseDown handler. I think I knew this many, many years ago, but I 
>> forgot. 
>> 
>> Bob S
>> 
>> 
>>> On Jan 27, 2025, at 9:28 AM, Craig Newman via use-livecode 
>>>  wrote:
>>> 
>>> Bob .
>>> 
>>> “popup” is not a command that creates a button. It only works with an 
>>> existing button, opening its contents at a location of your choice. 
>>> That button can be hidden, but its menu will appear 

Re: Popup Button bug??

2025-01-28 Thread Bob Sneidar via use-livecode
Okay I see what you did. Actually, what I wanted was to have an empty choice to 
start with, because users are prone to do the minimal necessary, and will just 
click the save button without thinking about where the file will be stored. By 
creating the menu in such a way that either a valid choice is made or else any 
other action dismisses the "popup menu” I can check that the user selected a 
valid folder profile. 

Bob S

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Popup Button bug??

2025-01-28 Thread Bob Sneidar via use-livecode
I am also using a field. Half the magic occurrs outside the field script 
though. 

Bob S


> On Jan 28, 2025, at 7:07 AM, Craig Newman via use-livecode 
>  wrote:
> 
> Did you try my stack? It does not use a button at all for the menuItem list, 
> rather a field. Looks the same, much easier to manage.
> 
> Craig
> 
>> On Jan 27, 2025, at 4:18 PM, Bob Sneidar via use-livecode 
>>  wrote:
>> 
>> Not at all. I have a File Server Agent that uses socket communications. I 
>> first get a list of files from the user, then I query the server or a list 
>> of what I call Profiles which right now are just a name and a file path on 
>> the server. 
>> 
>> I want to present the client user with a list of the names of those 
>> profiles. If the user does not select a profile, either by clicking off the 
>> menu I pop up, or by hitting the escape key, then I notify the user that 
>> they must choose a profile. 
>> 
>> If they do choose a profile then I send the server an array with some 
>> key/values, and the file data is stored in a numbered array in the data key. 
>> Each key in the data keys is first encrypted, then tho whole of the array is 
>> arrayEncoded, then base 64Encoded before opening a socket and sending the 
>> data. 
>> 
>> I tried using the popup menu button but that will not work unless the popup 
>> button command is called from a mouseDown or mouseUp handler. I am making 
>> the call from a behavior script which is why I was getting the error. And 
>> besides, you can’t control the popup menu’s appearance, whereas with a field 
>> you can. Also I am anticipating having more values than can be entirely 
>> displayed by a popup menu without running out of screen real estate, so a 
>> scrolling field works much better. 
>> 
>> I’m curious how you would do that with native controls? 
>> 
>> Bob S
>> 
>> 
>>> On Jan 27, 2025, at 12:27 PM, Craig Newman via use-livecode 
>>>  wrote:
>>> 
>>> Bob.
>>> 
>>> What are you trying to accomplish that the native buttons do not do for 
>>> you? The popUp command, to me, is simply a tool to invoke a display of 
>>> resident menuItems that do not necessarily have to live at the button 
>>> location itself, and that button not even needing to be visible.
>>> 
>>> Are you adding a lot of additional gadgetry?
>>> 
>>> Craig
>>> 
 On Jan 27, 2025, at 2:01 PM, Bob Sneidar via use-livecode 
  wrote:
 
 Interesting, the dictionary didn’t mention mouseUp. But some kind of mouse 
 up or down handler has to be what makes the call. 
 
 It turns out that rolling your own blocking popup “menu” is not very 
 straightforward. Here is what I came up with: 
 
 on popupMenu pMenu, pItems, pLocation
 -- anything less than 3 lines and the scrollbar does not display correctly
 if the number of lines of pItems >3 and \
  the last char pItems is cr then \
  delete last char of pItems
 
 set the text of pMenu to pItems
 set the height of pMenu to \
  min(the formattedHeight of pMenu, 178) — for me 178 is 10 lines of 
 formattedText YMMV
 set the width of pMenu to the formattedWidth of pMenu
 set the topLeft of pMenu to pLocation
 show pMenu 
 focus on pMenu
 set the hilitedLine of pMenu to empty -- because focus will auto-select 
 line 1
 wait until the visible of pMenu is false with messages
 end popupMenu
 
 
 — in the script of a Scrolling List Field
 local lParentCard
 
 on selectionChanged
 put getParentCard(the long id of me) into lParentCard
 put the hilitedLine of me into tLine
 put line tLine of the text of me into tItem
 set the currentLocation of lParentCard to tItem — or whatever you want to 
 do with tItem
 hide me
 end selectionChanged
 
 on escapeKey
 selectionChanged
 end escapeKey
 
 on focusOut
 selectionChanged
 end focusOut
 
 FUNCTION getParentCard pObjectID
 put offset("card id", pObjectID) into tStartChar
 put char tStartChar to -1 of pObjectID into tCardID
 return tCardID
 END getParentCard
 
 Bob S
 
> On Jan 27, 2025, at 9:39 AM, Craig Newman via use-livecode 
>  wrote:
> 
> Bob.
> 
> It works just fine in a mouseUp handler as well. I just did it. 
> 
> Craig
> 
>> On Jan 27, 2025, at 12:31 PM, Bob Sneidar via use-livecode 
>>  wrote:
>> 
>> Understood. That is why I wrote, I assure everyone there *IS* a button 
>> called “mnuLocations”. As I posted later, this command can only be used 
>> in a mouseDown handler. I think I knew this many, many years ago, but I 
>> forgot. 
>> 
>> Bob S
>> 
>> 
>>> On Jan 27, 2025, at 9:28 AM, Craig Newman via use-livecode 
>>>  wrote:
>>> 
>>> Bob .
>>> 
>>> “popup” is not a command that creates a button. It only works with an 
>>> existing button, opening its contents at a location of your