gre.press on table's cell
Hello,
I'm trying to build a calendar and I tried to set an action on table cells to call a callback in order to get the selected month's day.
Well first, is it normal that the table is not rendered in the storyboard designer?
Here is by config:
And when I click on a cell, the callbacks are not called.
Why?
PS: I would have been interested by this post. Unfortunately, is done in Storyboard 4 !
Alain
0
Comments
Hi Alain,
I've replicated your setup and it looks like the issue might be that the callbacks you're specifying are object methods. Currently, for callback actions, we check the global function table. Although there is a plan to update the Storyboard Engine to easier facilitate Lua OO, it may be easiest for now to stick to a global callback, that immediately passes the appropriate arguments to your object method/function.
Corey B
Thanks for your answer but maybe I didn't really understand your meaning as I doesn't work better:
I even tried to call the same callback as you (in callbacks.lua) and it's not called.
Sorry I found, the table was covered by something. I brang it to front and it's ok.
Anyway, I don't understand why the table is not visible in the editor.
And how to at least display a 'selection' rectangle to better visualize an object we are editing properties?
At least in my case, selecting a control in the least doesn't select it in the gde view and selecting a control in the gde view doesn't select it in the list
Regards,
Ok, so the press callback is working now?
For the display in Designer, I'm not sure if you are saying you can't see anything? Although any data that is populated at startup by Lua will not be rendered, you should still see any background, border, placeholder text, etc. on the cell.
Here is the sample I made for your callback question: https://drive.google.com/file/d/17UJae8wYz7l9pS_M9aiDh3l_B3A1uN_j/view?usp=sharing
As you can see in my sample, I have added a rectangle to the cell template to act as a border.
In my case, it's what I get:
So despite I have a white Cell background, the table is fully transparent.
I got the black rectangle displayed (selected object) by clicking twice on the lock attribute beside the visible attribute. When I just click on the object, as I said, I cannot see this rectangle.
I tried your example but as about the Table tuto, I get this error message. Why?
In fact my problem was just because my table was behind an other object because the table's cell can effectively call calendar.selectDoM() (object notation)
That is strange about the selection box.. have you accidentally created on offset on your cell template maybe? The table needs to be big enough to show the cells as well.
Take a look at this screenshot..
I clicked on cell 2,2 in the preview area and it gives an orange border around the whole table to show it's selected, and the normal selection box around the cell I picked.
For the import problem, I'm not sure what would cause that. Can you tell me which version of Designer you are running? (Help -> About Crank Storyboard). I had my coworker import the project I sent you and there were no problems.
In the Navigator view, right-click and select Import
Then select General->Existing Projects into Workspace
From the Import dialog, choose "Select archive file" and browse to the zip file I gave you.
Ok, good to know the object notation is working for you. Sorry about leading you astray on that, it seemed like the most likely cause.
If you are still unable to run the sample or my example, I would suggest creating a standalone example (or just a standalone layer and screen in your current project) where the table is by itself on the screen and fills the whole screen. Make the cell tamplate an appropriate size (eg. 80x80), then create a rectangle render extension on the cell template and see if you can replicate my example. I have also added a full screen light blue fill control behind the table for better visibility.
In fact the whole table is not shown, not only the cells. despite everything works fine at runtime.
Here is my installation details:
And I imported the project like that. :-/
Currently the only problem about object notation is that we cannot find these callbacks in the callbacks dropdown list when creating an action.
Ok, version numbers look good. Dang.. if that's how you imported I am stuck. I am not sure what would cause that, but hopefully another team member here has an idea and can comment.
I just noticed that you have "Match control width" unchecked for your white fill. This is fine, but I am wondering if you changed the size of the fill but actually meant to change the cell template? If you want the white fill to be the background for the whole cell then it is best to leave that checked. I would also suggest adding a fill control (eg. black or dark gray) to your table layer to contrast the light contents since it is hard to see against the checkerboard pattern.
Here is an example of my cell template size, it is 110x82 and the rectangle I'm using as a border has width and height set to 'match'.
You also mentioned that you had clicked the lock icon in the application tree. If you are trying to edit elements, double check they are not locked.
For one of the 2 tables yes, I had the match Width/Height unchecked but it doesn't change the behavior for this problem.
I just double click on Lock 'ON/OFF', to make the rectangle appear.
Maybe I could send you my project if you want to take a look at.
Sure, no problem. My email is cbigras at cranksoftware
Also, have you taken a look at the AddressBook sample? It uses a scrolling table with fills for cell backgrounds, it might make a good comparison to what you are working on.
It can be added to your workspace without an external download. Go to the Application tree view and toggle 'show models'
Then you can click "Import Sample Project" and select the AddressBook which is the first entry.
Address Book example works fine but it uses images as background instead of fills. I suppose it should make differences...
Ok for the show Model option, it's what I was looking for!
They are may be something bad in my project. I also have problem with SBCTextFiled's CursorAlpha which doesn't behave as expected. Cursor is always invisible for some fields, always visible for some others.
It would have been interesting to test it on Linux but unfortunately for licence reason, I think I couldn't install another Storyboard on my Ubuntu machine.
Please sign in to leave a comment.