Create Card does not take in account groups with BackgroundBehavior set to true

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
mrcoollion
Posts: 417
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Create Card does not take in account groups with BackgroundBehavior set to true

Post by mrcoollion » Mon Nov 04, 2019 8:38 pm

Hello LC experts,

I am trying to create a card via script in a tree view widget with

Code: Select all

create card tCardName
.
However, I came to the conclusion that it does not take into account groups with BackgroundBehavior set to true while if I create a card manually via the menu the new card shows the background groups as expected.
I tried

Code: Select all

place bg "TreeAndNavigation" onto cd tCardName
but this throws an error message?!
same goes for

Code: Select all

place background group "TreeAndNavigation" onto card tCardName
The error code:
widget"Tree View": execution error at line 33 (Chunk: source is not a container), char 1


Important fact: The code is in the tree view widget which is also part of this background group.
Does this prevent the group from being placed upon the new card? Are there any workarounds?

Regards,

Paul

Klaus
Posts: 11313
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by Klaus » Mon Nov 04, 2019 9:24 pm

Hi Paul,

just created a group (backgroundbehavior set to TRUE) with a TREE VIEW widget, a button and a radiobutton.
The button has a mouseup handler with: create card

Everytime I click the button a new card is created WITH this group on it.
So I cannot reproduce what you are experiencing, LC 9.5, macOS 10.14.6!?
This has always been working in LC.

But please post the complete script of your tree view widget.


Best

Klaus

mrcoollion
Posts: 417
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by mrcoollion » Tue Nov 05, 2019 11:07 am

So here is the stack i mentioned.
The goal is to only have to change the tree view structure and then to be able to add or delete associated cards with a tree item.
The only code to review is in the Tree View Widget.
TestTreevieuwCardUI1.zip
Test Treeview associated card creation and deletion
(2.56 KiB) Downloaded 5 times
In the Menu Tree only Tree Items Sub AA and Sub BA have cards associated.
Add or delete a card by double Click on the Tree Item.

Klaus
Posts: 11313
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by Klaus » Tue Nov 05, 2019 12:00 pm

Hi Paul,

tested and works as exspected!
I ended with these cards in the stack and the group including treeveiw was on every newly created card:
Sub AA
Sub CA
Menuitem with no subitems
Sub BA

The project browser however insisted that the new cards were EMPTY, until I closed and reopened that li'l sucker. :-)


Best

Klaus

bogs
Posts: 3995
Joined: Sat Feb 25, 2017 10:45 pm

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by bogs » Tue Nov 05, 2019 12:45 pm

Klaus wrote:
Tue Nov 05, 2019 12:00 pm
The project browser however insisted that the new cards were EMPTY, until I closed and reopened that li'l sucker. :-)
It does have that annoying new tendency, however, you shouldn't have to close it out, just collapsing / expanding the node should work :wink:
Image

mrcoollion
Posts: 417
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by mrcoollion » Tue Nov 05, 2019 2:00 pm

So I @#^%$ myself by having the project browser open for checking if my code worked :lol:
Thanks for spending time on this.

A question: is it possible to see the difference between clicking the right or left mouse button. I could not get that to work in the Tree View?

Klaus
Posts: 11313
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by Klaus » Tue Nov 05, 2019 2:22 pm

mrcoollion wrote:
Tue Nov 05, 2019 2:00 pm
A question: is it possible to see the difference between clicking the right or left mouse button. I could not get that to work in the Tree View?
Just made a quick test, and I'm afraid this widget, and others, does not react on any MOUSEXXX at all.
Too bad that widgets do not support these basic handler and most of the time "roll their own".
actionDoubleClick? COME ON! :D

mrcoollion
Posts: 417
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Create Card does not take in account groups with BackgroundBehavior set to true

Post by mrcoollion » Tue Nov 05, 2019 4:05 pm

Agree, MOUSXX should be supported in all Widgets.

Thanks, Klaus for taking the time for me. :)

Post Reply

Return to “Talking LiveCode”