Welcome, Guest
Please Login or Register.    Lost Password?

Matching table result to a second table
(1 viewing) (1) Guest
Go to bottomPage: 12345
TOPIC: Matching table result to a second table
#20965
Re:Matching table result to a second table 4 Months, 2 Weeks ago  
With a quick look, you can do this change to simplify the code:

Replace this:
Code:

<button id="Movie.button.play.2" element="bitmap.button.movie.play" origin="TOP-RIGHT" x="-21" y="174" w="20" h="20" action="Shadow4_Movie_Play_2(#SKIN#, #WINDOW#)" />

With this, for every Play button:
Code:

<button id="Movie.button.play.2" element="bitmap.button.movie.play" origin="TOP-RIGHT" x="-21" y="174" w="20" h="20" action="Shadow4_Movie_Play(#SKIN#, #WINDOW#, 2)" />


then change the function to allow a new argument:
Code:

function Shadow4_Movie_Play(skin, window, value)
  data = Rainlendar_GetItemValue(window, "Movie.page", "text")
  _, _, page = data:find("(.*)") if page then page = tonumber(page) end
  box = (value + page - 1)
  url = "file://" ..g_Shadow4_Movie_MovieCache[box] Rainlendar_Execute(url)
end



EDIT:
Question 1:
Code:


  IsShow = Rainlendar_GetItemValue(window, "movies", "visible")
  if IsShow == "1" and #g_Shadow4_Movie_MovieCache == 0 then
     Rainlendar_SetItemValue(window, "movies", "visible", "1")


I don't understand. If IsShow is 1, why you would set it to 1 again?
Jorge_Luis
Platinum Boarder
Posts: 792
graphgraph
User Offline Click here to see the profile of this user
Gender: Male My Rainlendar Skins Location: Argentina Birthday: 03/15
Last Edit: 2014/04/02 21:47 By Jorge_Luis.
The administrator has disabled public write access.
 
#20971
Re:Matching table result to a second table 4 Months, 2 Weeks ago  
Thank you Jorge_Luis for taking the time to look at it. I used your code for the play buttons and it works perfectly. That saves alot of space. You made me learn something new and I appreciate it.

Question: Can I get rid of the picture handler too? Can I replace
Rainlendar_DownloadElement(picurl, Shadow4_Movie_OnDownloadElement, "bitmap.movie.picture." .. count, skin, window)
with something like:
Rainlendar_SetItemValue(something, "bitmap.movie.picture." ..count, "something", something)
and then just call the handler by itself at the bottom of the function? (Need syntax for that too)


Oh, you're right about the IsShow line. It doesn't need to be there. Just garbage left over from too many cuts and pastes when I was testing. Deleted.
SereneSavage
Junior Boarder
Posts: 28
graphgraph
User Offline Click here to see the profile of this user
Gender: Female Location: Canada
Last Edit: 2014/04/03 17:29 By SereneSavage.
The administrator has disabled public write access.
 
#20982
Re:Matching table result to a second table 4 Months, 2 Weeks ago  
Hi,
Try to answer some your question. It's unprofessional reply.

I do not know how to turn it into a widget or to make it installable.
Made a separate skin-file (installable) :
a) The skin-file is a standard .zip file, but extension is changed as .r2skin, eg: rename movies.zip as movies.r2skin

b) Skin-file's standard structure : (if not need can keep folder been empty or delete it)
Code:

movies.r2skin
movies.r2skin\images\
movies.r2skin\scripts\
movies.r2skin\scripts\movies.lua
movies.r2skin\xmls\elements.xml
vmovies.r2skin\xmls\movies.xml
movies.r2skin\skin.xml



c) All .xml file must have : (you can to refer other's skin)
Code:

<?xml version="1.0" encoding="UTF-8"?>
<skin version="1.0">
...............
</skin>



d) skin.xml must include all variables definde, and other used file, eg:
Code:

  <variables>
    <variable name="Movie_Folder" default="" type="folder" window="Movie" description="Defines the local folder which is scanned for movies." />
    <variable name="Movie_Menu" default="" type="folder" window="Movie" description="Defines the local folder which is scanned for photos." />
  </variables>

  <scripts>
    <script file="scripts/movies.lua"/>    
  </scripts>

  <include file="xml/movies.xml" />
  <include file="xml/elements.xml" />



e) elements.xml must include all used element definde, eg:
Code:

  <elements>
    <font id="font.movie" facename="Arial" size="9" />
    <font id="font.larger" facename="Arial" size="20" />
    <bitmap id="bitmap.background.movie" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.random" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.1" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.2" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.3" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.4" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.5" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.6" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.7" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.8" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.9" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.10" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.11" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.12" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.13" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.14" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.15" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.16" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.17" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.picture.18" file="images/movie/movie-bg.png" />
    <bitmap id="bitmap.movie.black" file="images/movie/movie-black.png" />
    <bitmap id="bitmap.button.movie.icon" file="images/movie/movie-movie.png" frames="3" />
    <bitmap id="bitmap.button.tv.icon" file="images/movie/movie-tv.png" frames="3" />
    <bitmap id="bitmap.button.movie.play" file="images/movie/movie-play-button.png" frames="3" />
    <bitmap id="bitmap.button.movie.random" file="images/movie/movie-random-button.png" frames="3" />
    <bitmap id="bitmap.button.movie.previous" file="images/movie/movie-previous-button.png" frames="3" />
    <bitmap id="bitmap.button.movie.next" file="images/movie/movie-next-button.png" frames="3" />
    <bitmap id="bitmap.button.movie.home" file="images/movie/movie-home-button.png" frames="3" />
    <bitmap id="bitmap.button.movie.end" file="images/movie/movie-end-button.png" frames="3" />      
  </elements>




Made a skin-addon file :
a) The skin-addon be almost same with skin-file, but change extension as .r2skin-addon, eg: rename movies.r2skin as moviews.r2skin-addon

b) skin-addon standard structure :
Code:

movies.r2skin-addon
movies.r2skin-addon\images\
movies.r2skin-addon\scripts\
movies.r2skin-addon\scripts\movies.lua
movies.r2skin-addon\xmls\movies-elements.xml
vmovies.r2skin-addon\xmls\movies.xml
movies.r2skin-addon\movies-addon.xml
movies.r2skin-addon\skin



c) The different between skin-file and skin-addon:
Code:

1) Change elements.xml as xxxx-elements.xml (eg: movies-elements.xml), it's for not effect original skin.
2) Change skin.xml to xxxx-addon.xml(eg: movies-addon.xml), and add a plain-text file "skin" (no extension) 
3) The context of "skin" file is :
Shadow4  <-- the name of skin, will join addon
1.12     <-- the version of skin (note: not the version of Rainlnedar2)
4) modify movies-addon.xml, change  <include file="xml/elements.xml" />  as  <include file="xml/movies-elements.xml" /> to match file's name.



Is there a way to make it so that you can move the screen position of one window while the other stays in the same place?
I thinks, at the moment, it's impossible.(it's very difficult)

Also, my toggle windows sometimes don't work if Rainlendar is focusing on another window
I take a quick look, the reason is: You use Rainlendar_Redraw(0, userdata), but "userdata" not been define, you must to use "userData". In Lua, "userdata" not equal "userData".

Question: Can I get rid of the picture handler too?
You can try: Rainlendar_SetElementValue
Code:

Syntax
Rainlendar_SetElementValue(skin, element, field, value)

Parameters
skin (string) - The name of the skin.
element (string) - The name of the element in the skin.
field (string) - The name of the element's field.
value (string) - The new value for the item's field.

Return
Nothing 

Description
This sets a new value for the element's field. See Rainlendar_GetElementValue function for more details about the item and their fields. Note that you need to call Rainlendar_Redraw function before the changes will be visible.


And, the examples, can refer my last reply.
www.rainlendar.net/cms/index.php?option=com_kunena&Itemid=42&func=view&catid=6&id=20802&limit=6&limitstart=6#20853
anoob
Platinum Boarder
Posts: 498
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
Last Edit: 2014/04/06 12:58 By anoob.
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
#20985
Re:Matching table result to a second table 4 Months, 2 Weeks ago  
anoob wrote:
Also, my toggle windows sometimes don't work if Rainlendar is focusing on another window
I take a quick look, the reason is: You use Rainlendar_Redraw(0, userdata), but "userdata" not been define, you must to use "userData". In Lua, "userdata" not equal "userData".

In several places, you use the window variable but it doesn't exists in this scope. I mean, something like this:
Code:


function name(this_number)
  show_x_in_a_window(this_window, this_number)
end


But this_window doesn't exists, unless you use userData as a function's argument, or the window value by itself.
Jorge_Luis
Platinum Boarder
Posts: 792
graphgraph
User Offline Click here to see the profile of this user
Gender: Male My Rainlendar Skins Location: Argentina Birthday: 03/15
Last Edit: 2014/04/06 16:21 By Jorge_Luis.
The administrator has disabled public write access.
 
#20990
Re:Matching table result to a second table 4 Months, 2 Weeks ago  
Jorge_Luis wrote:In several places, you use the window variable but it doesn't exists in this scope.
But this_window doesn't exists, unless you use userData as a function's argument, or the window value by itself.

Yes, this is because I have NO IDEA how this works yet.
I just follow what was on the photo widget, alot that I already deleted, and cross my fingers and hope it still works.

anoob wrote:the reason is: You use Rainlendar_Redraw(0, userdata), but "userdata" not been define, you must to use "userData". In Lua, "userdata" not equal "userData".
Things like this are so frustrating!!! I've wasted hours with these silly mistakes.
Thank you VERY much for telling me this.

anoob wrote:Question: Can I get rid of the picture handler too?
And, the examples, can refer my last reply.
www.rainlendar.net/cms/index.php?option=com_kunena&Itemid=42&func=view&catid=6&id=20802&limit=6&limitstart=6#20853


Ok, so now I have:
Code:

string = "D:/Movies/testpicture.jpg"  -- from a table
for count = 1, 18 do
  picurl = "file://" ..string  
  Rainlendar_SetElementValue(skin, "bitmap.movie.picture." .. count, "file", picurl)
  Rainlendar_SetItemValue(window, "Movie.picurl." ..count, "element", "bitmap.movie.picture." .. count)
end



Then at the bottom of this function I have:
Code:

Shadow4_Movie_OnDownloadElement(result, data, userData)
end


I know this is wrong

The callback function is now:
Code:

Function Shadow4_Movie_OnDownloadElement(result, data, userData) 
  for count = 1, 18 do
    Rainlendar_SetItemValue(window, "Movie.name." ..count, "visible", "1")
  end
  Rainlendar_Redraw(0, userData)
end


I know this is wrong too. I know it's not really a callback anymore. What I don't know is how to make it right.
What's happening now is that the OnDownloadElement function is working because I can see my movie name in the window, but the picture is still blank, it is not being shown.


Remember, I don't know Lua. I'm learning as I go.
SereneSavage
Junior Boarder
Posts: 28
graphgraph
User Offline Click here to see the profile of this user
Gender: Female Location: Canada
The administrator has disabled public write access.
 
#21007
Re:Matching table result to a second table 4 Months, 1 Week ago  
Hmm, I take more time to look your codes, and have try to make some modification. (see attached)

a) Just like you said: "it works quickly", so there is a lot of codes can be not need. (or say: it almost not be see)
sample:
Code:

function XXXX()
  if XXXX then
    ----
  end
  Rainlendar_Redraw(0, window)  <-- Don't need -->

  if XXXX then
    ----
  end
  Rainlendar_Redraw(0, window)  <-- Don't need -->

  if XXXX then
    ----
  end
  Rainlendar_Redraw(0, window)  <-- only need this one -->
end



b) Rainlendar_DownloadElement() is offer to download network's element, if element is on local, can directly use Rainlendar_SetElementValue() to change element.

c) If element is on local, the path of element should be "D:/XXXX/XXXX", don't need use "File://D:/XXXX/XXXX".

d) Suggest don't named variable's name same with program's "keep words", e.g. "string", because that may cause error, at some program-language.

e) Limit & suggest: the path and filename don't contain foreign (double-byte) characters, that will cause some error. (I still don't know how to solve it)

f) All lua's file change can search "--- " to check.

g) Still, I'm non-professional.


File Attachment:
File Name: Movies_20140411-ecb4a9b53acccb0e0dc4979729853bd4.zip
File Size: 463470
anoob
Platinum Boarder
Posts: 498
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
Last Edit: 2014/04/12 02:32 By anoob.
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
Go to topPage: 12345
get the latest posts directly to your desktop