Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Toolbar intermittently crashing
#3
Gintaras, thanks so much for the help. I am not a programmer, Quick Macros was the only language I ever learned (aside from Transact-SQL). I appreciate the advice on the better way to write the code, your examples were invaluable to me.

I was able to resolve the issue by using the paste command, that stopped the crashing. Everything worked great for a week, then a new problem with the toolbar suddenly started one morning. Clicking on the toolbar in the past never changed the position of the cursor, therefore whatever textbox and/or window I clicked on last would receive the pasted text. Starting on Thursday morning, as soon as you click on the toolbar it moves the cursor out of the active window and sets it to nowhere. For example, I open notepad manually. Then I click into the notepad window because I want to paste text into there. Prior to Thursday, if I clicked on a toolbar menu item it would paste the corresponding text into the notepad window. Now when I click on the toolbar, the notepad window becomes inactive (the same effect happens if I click on the taskbar or anywhere else). Now I am unable to paste text into anything. I cannot use accessible objects to paste since I am working thru an RDP session. Normally since the RDP window is full screen and the toolbar sits on top of it, the text pastes into wherever the cursor is inside the RDP session. Since the RDP window is becoming inactive now, the text pastes to nowhere. I then started troubleshooting this on the local desktop using notepad, it has the same effect. I toggled the "lock foregroung window" option in QM, no change. There was no changes to the notebook other than a Windows Defender definition update that was pushed by Microsoft, no setting changes or software installs. I cannot figure out why the toolbar acts this way now.

To update you on what I did in response to your initial advice, I explain all my changes below. After all those changes, the toolbar worked flawlessly:

I decided to rewrite the entire program after I got your message. Since this program will constantly be added to, I decided to put all the templates (text strings) into a single function names "GLOBAL_TEXT". I declare each template as a global variable, the function is triggered by the start of QM.

Here is my toolbar itself:

Code:
Copy      Help
/hook __tb_auto_size
REASON :mac "REASON"
EXAM :mac "EXAM"
TEST :mac "TEST"
:clo val(_command) * close.ico

This is my GLOBAL_TEXT function where I keep all the text templates themselves.

Code:
Copy      Help
def reason_one "Reason Toolbar Menu Item one is entered here."
def reason_two "Reason Toolbar Menu Item two is entered here."
def exam_one "Exam Toolbar Menu Item one is entered here."
def exam_two "Exam Toolbar Menu Item two is entered here."
def test_one "Test Toolbar Menu Item one is entered here. "


This allows me to update the text menus or add new items in a much more organized manner. I will update my menus themselves as you suggested, doing the paste within the menu itself. I did not change the menu structure itself yet, first I put all the text strings in a single function since I have at least 20 of them and I constantly add more. Today I will put all the paste commands in the menu's themselves.

Please let me know if you are able to determine why clicking on the menu suddenly takes focus off the last window that was active? I know that I can change focus to the prior window that was open using the acc command with no window name, but if I do that and then this new problem resolves itself, it will then make the focus change back to the window I clicked on prior to the unintentional change in cursor position that is currently happening (change, meaning focus changes to nowhere).

Is there a way to make this toolbar a standalone program or an exe, or do I have to run this within quick macros itself?

Thanks for your assistance.

Kevin


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)