PDA

View Full Version : How to limit the <windowlist> to single item?



Valyar
May 2nd, 2021, 18:12
Is there a way to enforce limits of <windowlist> to single item?

superteddy57
May 2nd, 2021, 21:15
Yes, do a check when a new entry is made and see if the windows would exceed your desired amount. If so, return false.

Moon Wizard
May 3rd, 2021, 07:06
My suggestion is that you really don't want to do this; because it's not the right type of control for the situation. If you simply need an embedded window; then use a subwindow instead.

Regards,
JPG

Valyar
May 3rd, 2021, 12:38
What I am trying to achieve is to have similar to the party sheet's order tab, where PC can be dragged & dropped but the list restricted to single character. Of course, I found other issues that I have to address first, but the goal is to have something like that.

What is the preferred approach here?

Trenloe
May 3rd, 2021, 13:09
As Moon Wizard mentions - if you're just displaying one set of data held in a <windowclass> specification, then use subwindow. You can change the database source of the subwindow using setValue: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645196/subwindow#setValue

Use the subwindow onDrop function code to change the database source to the new PC charsheet node when a PC is dropped on the subwindow.

However, the Party Sheet order tab - watch order section is a windowlist that contains more than one entry. So I'm confused as to what you're trying to do.

Valyar
May 9th, 2021, 07:44
I think I posted here prematurely, I have to think through the end-goal, there might be indeed better option than list with single item.

celestian
May 9th, 2021, 08:10
I think I posted here prematurely, I have to think through the end-goal, there might be indeed better option than list with single item.

I wanted to mention I considered a similar approach when rebuilding the CT in the 2E ruleset. I wanted it to use the windowlist for the selected entry from the CT as a single windowlist because I thought it was much easier to hand off data to a windowlist.

In the end, I went with a windowclass and used the API calls to "set" a database for the window.

I understand the thought process but there is probably a better way to go about it using a non-windowlist.