Ctrl+Z doesn't work with Application Extension

Jack S wrote on 12/21/2023, 5:35 AM

@jetdv Edward, I have used the 'using (UndoBlock undo = ...' many times in my application extension. For some reason, I can't use Ctrl+Z to undo the action. Edit/Undo works, and Ctrl+Y reverses the undo. Have you any idea why Ctrl+Z doesn't work?
This is a sample

using (UndoBlock undo = new UndoBlock("Add Titles and Text Event"))
                {
                    Apply_Plugin(lLen, ELen, PlugNme.Text, myFiOLen);                     //Call the sub-routine to apply the event
                }
Am I missing something?

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

Comments

jetdv wrote on 12/21/2023, 8:46 AM

@Jack S, I just did a test. I performed an operation in Excalibur, hit CTRL-Z, and it undid the operation. So it should work fine. My only thought might be which window had the focus when you hit CTRL-Z? Perhaps VEGAS itself did not see it?

Jack S wrote on 12/21/2023, 8:49 AM

@jetdv You've got it. The timeline needs to have focus for it to work. Thanks.

EDIT. Correction. Either the timeline, preview or trimmer window needs to have focus.

Last changed by Jack S on 12/21/2023, 8:55 AM, changed a total of 1 times.

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

Jack S wrote on 12/22/2023, 8:07 AM

@jetdv Edward, I wonder if you could help me again. WRT switching focus so that Ctrl+Z works, I found a reference in the API

void SetFocusToMainTrackView()

but I've no idea how to use it in my code block. I know where I want to put it, but I've tried using various references to get it to work. It's obviously not a case of simply entering that line. There must be some form of declaration that goes with it, but I can't figure that out. Any help would, as always, be appreciated.

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

jetdv wrote on 12/22/2023, 9:09 AM

@Jack S Here's how I do it in Excalibur. I set this external call up (just put it outside any other functions)

        [DllImport("USER32.DLL")]
        public static extern IntPtr SetFocus(HandleRef hWnd);

Then I call it with:

SetFocus(new HandleRef(null, myVegas.MainWindow.Handle));

Calling SetFocus then returns focus back to the main VEGAS window and allows all keypresses to go there instead of to the custom command. I use this mainly on the camera selection form in Excalibur where focus needs to go back to the timeline so the space bar can start/stop the playback but the clicks will still work to change the camera angles.

The command you listed above is part of the Dockable Control.

Jack S wrote on 12/23/2023, 8:18 AM

@jetdv Got there eventually. My first test was discovering that I had to include the
using System.Runtime.InteropServices; reference to be able to use the [DLLImport("USER32.DLL")] statement.
Although I new where to place the call statement, I wasn't sure where to put the external call. I tried several places unsuccessfully (I misunderstood your statement "just put it outside any other functions").
I finally found that I had to put it inside the UserControl block.
That did it. This tab now allows Ctrl+Z to work. I'll now proceed to put it into my other tabs.
Thanks again for pointing me in the right direction.

 

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

jetdv wrote on 12/23/2023, 8:25 AM

@Jack S Yes, I do have using System.Runtime.InteropServices; in that file.

And, yes, it does have to go inside the UserControl. Here's a little more context:

        [DllImport("USER32.DLL")]
        public static extern IntPtr SetFocus(HandleRef hWnd);

        private void ClickButton(object sender, EventArgs e)
        {

It's outside all functions but inside the UserControl. Glad to hear you got it working. As it *is* a function, it makes sense that it's outside all other functions.

Jack S wrote on 12/23/2023, 9:01 AM

@jetdv That bit of information is now in my scripting documentation. Thanks. On a side note, how do you get to enter that code in that oblong opaque frame in your comment? I haven't been able to figure that out yet.

Last changed by Jack S on 12/23/2023, 9:02 AM, changed a total of 1 times.

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

jetdv wrote on 12/23/2023, 9:06 AM

@Jack S Paste it into this box. Highlight it, and the click on the "Insert Code" <> button at the top.

This will be put into the box!

Jack S wrote on 12/23/2023, 9:23 AM

@jetdv Got it. I have tried that before, but because the box wasn't grey, I thought, "that isn't it". It obviously goes grey after the comment is posted.
Thanks again.

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE