PDA

View Full Version : Windowlist Question



meathome
May 7th, 2010, 09:02
Is there a way to allow the user only to delete listitems that are user created?

So for example I fill in some items in onInit() those should be undeletable, but any others later added by the the user should be deletable.

It would be easy if there was a onDelete() event that could be overriden... but there isnt one.

Any suggestions?

Zeus
May 7th, 2010, 09:34
If your using <allowdelete /> as part of the list definition then users who have ownership of entries can have access to a radial menu option to delete an entry.

Assuming the user is the owner of the entry's window database node then you can use the database node's isOwner() method to determine if they can delete it from within the menu selection handler, e.g.

For the windowlist item class, define an onMenuSelection() method to capture the delete entry (default radial position is 6 I believe).


function onMenuSelection(menuoption)
if menuoption == 6 then
if window.getDatabaseNode().isOwner() then
window.getDatabaseNode().delete();
end
end

meathome
May 9th, 2010, 06:13
Thanks exactly what I needed!

Another thing came up... I have a windowlist with entries that have some rows of controls on them that are switched to invisible depending on one of the fields.

Theres a genericconontrol attached to the windowclass witch I use as listitem this uses the anchoring shorthand over so it should be the same size az the windowclass...

but the following happens:
https://img88.imageshack.us/img88/8759/pickg.jpg

As is seeable in the second listentry the frame does not resize.

I tried calling setSize() on it doesn't do a thing..
I tried window.frame.size.height.setValue()... doesn't work either.

So how do I acomplish this?

Zeus
May 9th, 2010, 09:10
Its pretty tricky to tell without seeing your source, however if you have defined the anchoring for the list, with left, right, top and bottom edges, you shouldn't have to define the size of the window entries as long as they too are anchored to a defined left, right, top and bottom edge.

In fact I think there's a warning in the ruleset documentation regarding using setSize on windows which are sub-elements to a windowlist, unpredictable results may occur.

In cases whereby an entry window (or subwindow) is not matching the list width size then I usually try the following:

- Check to see if the entry item window defines a minimum sizelimit for width, if not add one and re-try
- Add a genericcontrol which does nothing but occupy space, call it something like 'spacer' and use it to 'pad' out you entry item's window (or subwindows) to the defined width/height you need.

meathome
May 9th, 2010, 09:50
The windowclass has a defined minimumwidth and minimumheight. The problem is that some entries should resize their height according to visible controls.

I already have a generic control that does nothing, this has the frame defined for the listentry. Its this generic control that does not resize with the listentry windowclass. I have it anchored with the shorthand, but ill try to set the anchors the long way now.

Ill post how that works out.

Edit:
I tried that doesnt make a difference. If I delete taht generic control and set the frame directly on the window cass it works... But then I cant set offsets for the frame. Is there a way to do that?

Zeus
May 9th, 2010, 10:56
The only way I know to offset a windowclass frame is to offset the graphic asset with transparency. I don't believe you can use the <offset> tag as with window controls, then again perhaps someone else can confirm?

Going back to setSize() for a moment, did you try setAnchoredHeight()?

BTW. What ruleset are you working on/creating?

meathome
May 9th, 2010, 11:17
Ill try that one next. Im modifiying the Dark Heresy ruleset for rogue trader (not much modfiying needed) and adding all kinds of automation I can think of :P.
For example automatic ammo tracking, click rolling etc.

I have already remade the skill tab to be more like the skill lists of the Roge Trader example characters.

Im not sure I will really finnish it. I have a bad habit of leaving project half finished if they are usabel enough to play (most cases a charactersheet). I have an Anima sheet/ruleset lying around somewhere that I never finished.

EDIT: Tried setAnchoredHeight worked like a charm :D thanks very much

Zeus
May 9th, 2010, 11:54
A Rogue Trader ruleset sounds good. If your open to sharing them I know Oberoten will usually support hosting at the FGWiki. I'm sure there are others who would enjoy being able to play these games with FGII too.

The other bonus is that if your unable to finish them personally due to time or other constraints, there are usually a few community members who are willing to step in and can contribute. Just a thought.

Either way, the best of luck with your endeavors.

meathome
May 9th, 2010, 12:13
I´m happy to share, the only thing is that I have "stolen" many parts of the dark heresy ruleset so Ill have to ask the original creator.

The anima one is just a character sheet but if theres interest Ill write to obteron to host it somewhere. Maybe then someone can implement the table lookup I didnt manage to do...

Zeus
May 9th, 2010, 15:25
Glad you got it working and great to hear your willing to share, I'm sure the community will be grateful.

Z.

peterb
May 10th, 2010, 13:17
I´m happy to share, the only thing is that I have "stolen" many parts of the dark heresy ruleset so Ill have to ask the original creator.

The Dark Heresy ruleset is licensed under the OGL (see the headers of the script files) so while it's polite to ask - it's from a legalese POV not necessary.

meathome
May 13th, 2010, 07:09
Is there a way to make fg wait for the dice to drop? So that I can guarantee that chatentries arrive after they have landed?

And what is tthe reason that the module thumbnail wich shows up fine in the module selection, is not visible in the library?

And some formatted text from the module is underlined even tough I never specify for it to be so?

Edit: Heres a linkt to the Anima charshett I have started (its not nearly done but it was enough for our group to play with till they decided they dont like the feel of the system :( )

https://netload.in/dateiqxbQUx66vl/AnimaCharsheet.zip.htm

Zeus
May 13th, 2010, 08:51
Is there a way to make fg wait for the dice to drop? So that I can guarantee that chatentries arrive after they have landed?

Use the chatwindow's onDiceLanded() method. Its only called once a die has been rolled in the chatwindow and landed.


And what is tthe reason that the module thumbnail wich shows up fine in the module selection, is not visible in the library?

Hmm, not 100% sure. Have you set the Category for the module e.g. 4E Core Rules etc. Check to make sure you have no ampersands or punctuation characters in the Category name.


And some formatted text from the module is underlined even tough I never specify for it to be so?

When you say formatted text do you really mean a formattedtext field?, If so you will be limited by what you can do in script as the formattedtext object has no getValue() or setValue() methods.

meathome
May 13th, 2010, 11:26
Yes I'm setting the category name, it has no unusial characters its simply:

<name type="string">Core Rules</name>
<categoryname type="string">Rogue Trader</categoryname>

The thumbnail shows up fine in the module selection but not in the library.

Yes I'm using a formatedtext field but its ok that i can nott acces it from script, because all the values I need are stored in other fields. The formatedtext is simply a description. The values of all these fields come from a library module. And sometimes (seems quite random) all the text displayed in the fromattedtextfield is underlined... This changes on its own from time to time when reloading the ruleset (so when I reload it, it can happen that an entry that was fine before gets underlined or vice versa.)

About the dicelanded question: So the only way to prevent a player from for example clicking a button while the dice are "in the air" would be to for example have a variable diceInAir set it to true when some control calls throwdice and set it to false anytime onDiceLanded() is called, and then in the said button check for this variable and do nothing if its true.

I was hoping for something eleganter but it will do. I will just have to edit all the controls that should wait for the dice to land before they can be used again.

Zeus
May 13th, 2010, 13:39
I apologize up front if you have already done this but have you activated the module in the Module Selection window (drag the brown book icon next to the module name to open)?

Regarding the formattedtextfield, have you defined what each of the font styles are? e.g.



<formattedtextfield name="text">
<anchored>
....
</anchored>
<font>
<normal>...</normal>
<bold>...</bold>
<italic>...</italic>
<bolditalic>...</bolditalic>
<title>...</title >
</font>
...
</formattedtextfield>

meathome
May 13th, 2010, 14:46
Yes the module is activated and a tried reactivating it multiple times.
It appears in the libraray just without the thumbnail.

Yes all the fonts are defined for the formatted textfield. Strangely the issue with the underscored text didnt happen for some time now. I have changed nothing with the textfield or data displayed within, so I have no idea why it has not happened.

Foen
May 13th, 2010, 15:54
The module may appear in module selection but not in the library if its content sin't well-formed XML. Try opening the module xml file in Internet Explorer and see if there is any complaint.

I also have an intermittent problem with underlined text in formattedtext fields, and think it must be some glitch in the FG engine. It seems to occur more frequently with complex/long formatted text, and isn't reliably reproducible.

Foen

meathome
May 13th, 2010, 21:27
The module appears fine in the library, all the data is there. It is just the thumbnail image thats not visible in the library.

Yes I have experienced the same with the formatted text. Its random but it isnt such a big deal.

BTW Im thinking about how much automation is good, too much or too little. Because I ran into some issues where automation hurts flexibility :)