Panel Scaling in the Scripts

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Panel Scaling in the Scripts

#1 Post by RoundEngine »

I think I know that the answer is no but I want to ask anyway. if I create a panel and define a size can I resize it from a script. I haven't found anything in the API guide but wanted to ask in case I'd missed something.

Thanks.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Panel Scaling in the Scripts

#2 Post by Keith Baxter »

Hi

Yes you can.

Use move() to scale the instruments in a panel script.

Check “instruments” in the API

There are some restrictions.
Give some more info on what and why you need to do this.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Re: Panel Scaling in the Scripts

#3 Post by RoundEngine »

I've been using a Cougar MFD to do things like change views or activate events in P3D and X-Plane. For example I can change X-Camera views in X-Plane simply by pushing a button so I can quickly check another panel. However, the Cougar has a limited number of buttons so I figured I'd create a panel in Air Manager, put buttons on it, and use it to change views and trigger actions such as toggling LNAV or VNAV. I would like to have the user define the number of rows and number of columns and the button size. From there I would set the panel size so buttons of the defined size will fit with n rows and m columns. I plan to use if for P3D and perhaps MSFS as well.

Maybe there is a better way to do it and if so I'm open to it.

So I can scale the instruments/buttons but can I actually resize the panel so if the user has x columns with buttons or a given size I can have the panel be x*buttonwidth wide?

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Panel Scaling in the Scripts

#4 Post by Keith Baxter »

Hi,

If your panel is an “instrument” and is done in canvas_draw() that is easy to do.

If your panel is a img then you would need multiple images.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Re: Panel Scaling in the Scripts

#5 Post by RoundEngine »

I am not using an image for the panel but I'm not clear on when a panel is an instrument. I've created panels with New-Panel and created the scripts to control it. I did that since I created what would be a panel in an aircraft. If I go to New -> Panel and set a size there have I created an instrument or do you mean I need to go to New -> instrument and create it there. In either case I still have to define a size.

I'll look into the Canvas API more. I've not used it.

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Panel Scaling in the Scripts

#6 Post by JackZ »

RoundEngine wrote: Mon Jul 05, 2021 8:20 pm I've been using a Cougar MFD to do things like change views or activate events in P3D and X-Plane. For example I can change X-Camera views in X-Plane simply by pushing a button so I can quickly check another panel. However, the Cougar has a limited number of buttons so I figured I'd create a panel in Air Manager, put buttons on it, and use it to change views and trigger actions such as toggling LNAV or VNAV. I would like to have the user define the number of rows and number of columns and the button size. From there I would set the panel size so buttons of the defined size will fit with n rows and m columns. I plan to use if for P3D and perhaps MSFS as well.

Maybe there is a better way to do it and if so I'm open to it.

So I can scale the instruments/buttons but can I actually resize the panel so if the user has x columns with buttons or a given size I can have the panel be x*buttonwidth wide?
Hi.
If you want a resizable panel with a different number of rows and columns, then you have to create it at runtime and canvas draw is probably a solution, with transparent button over these rectangles. You’ll probably have to change the button’s color to give a feedback of whether the button has been pressed which may create some code overhead.

Or else use two images (pressed and released) that you will reuse for every button, by position and resize.

I tend in this case to prefer the latter solution, as the animation code is built in on AM within the button() function, which is not the case with canvas() rectangles.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Panel Scaling in the Scripts

#7 Post by Sling »

The simple answer is you cannot resize a panel. However as the guys have pointed out you can resize the elements within the panel or instrument either upon first run or on the fly at a later point in time. The chosen panel size would therefore have to be set to the largest size it’s ever going to be.

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Panel Scaling in the Scripts

#8 Post by JackZ »

okay, I gather that talking about panel, you instead mean a single "instrument" in a panel.

Something like this?
image.png
image.png
image.png
Certainly doable, but not simple though, you'll have to create an indexed array of functions in order to be able to address each button with its specific function, since each button's size & position is determined at runtime.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Re: Panel Scaling in the Scripts

#9 Post by RoundEngine »

That is what I was thinking of. The only difference is the panel - the area containing the instruments would be resized so the buttons line up neatly - each row being the width, each column the height but it's not doable so I'll work around that.

Oh, yes. I'd have to have an array to handle the each button's function.

Thank you all for the input. I'll have to think on this for a while.

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Panel Scaling in the Scripts

#10 Post by Keith Baxter »

Hi,

The “PANEL” can be an instrument within a panel on a transparent background.
The “PANEL” (instrument) can be moved and resized in whole or part.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply