Card Question

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Card Question

Post by warrenk » Mon Nov 10, 2008 7:57 pm

What would be the best way to "refresh" a card? I have a card where I am updating dropdown fields from a SQL database. When a update is done, I want to rerun the "on opencard" function which contains the statements to load my dropdown fields. Should I just close and reopen the card or can I specify a call to the "on opencard" function?

Hope I am making sense. :)

Warren

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Nov 10, 2008 8:31 pm

Hi Warren,

You can make a new handler, which contains the entire openCard handler, but with a different name. Call this handler from the openCard handler and from the handler that is supposed to refresh the card. There is no need to go to a different card and back.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Post by warrenk » Mon Nov 10, 2008 9:17 pm

Mark,

Would this be a function I create?

ie.
on opencard
call RefreshCard
end opencard

function RefreshCard
(enter code)
end RefreshCard

Thanks for your help!
Warren

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Nov 10, 2008 9:19 pm

Hi Warren,

No, not like that. This would be a handler of the form

Code: Select all

on handlerName
  -- do something here
end handlerName
You can call it, simply by issueing the command. You don't need to use the call command.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

warrenk
Posts: 110
Joined: Sun Sep 21, 2008 5:39 am

Post by warrenk » Mon Nov 10, 2008 9:39 pm

Mark,

Thanks...this works. Appreciate the help!

Warren

Post Reply