PDA

View Full Version : More than one dropdown menu on a CCF page or in a CCF



Mastiff
January 7th, 2005, 08:13 AM
I'm creating a few drop down menues (which should be pretty easy coding, that's why I dare to attempt after my very poor coding record the last copule of days...), but the problem I have is that when I enable one menu, the other two dissappear. It is possible to have more than one dopdown menu in a CCF, right? And even on one page, right? I really don't understand what I'm doing wrong, and I have searched and looked here, and I have looked at the nrdemo.ccf which has more than one dropdown, but I can't find the LUA file for that. Could anybody tell me where that is?

If it helps, here's the code (the first menu with the URLs wasn't created by me, I have created the two at the bottom):

function OnPanelLoad(SURF)
SelectedUrl= {}
SelectedUrl["Agderposten"] = "http://www.agderposten.no"
SelectedUrl["AV-forumet"] = "http://www.avforum.no"
SelectedUrl["AVS-forumet"] = "http://www.avsforum.com/avs-vb/usercp.php?s="
SelectedUrl["IMDB - Internet Movie Database"] = "http://www.imdb.com"
SelectedUrl["Kennelsiden"] = "http://mastinuff.now.nu"
SelectedUrl["Kvasir"] = "http://kvasir.sol.no/"
SelectedUrl["MediaCenter-forumet"] = "http://yabb.jriver.com/interact/index.php?board=3"
SelectedUrl["Promixis-forumet"] = "http://www.promixis.com/phpBB2/"
SelectedUrl["Telefonkatalogen"] = "http://www.telefonkatalogen.no"
SelectedUrl["Telio-forumet"] = "http://www.telio.no/cgi-bin/forum/discus.cgi"
SelectedUrl["Tv-programmet hos VG"] = "http://interaktiv.vg.no/tvguiden/"
SelectedUrl["VG"] = "http://www.vg.no"
SelectedUrl["Været - korttidsvarsel"] = "http://met.no/aust-agder/index.html?fylkesvis"
SelectedUrl["Været - langtidsvarsel"] = "http://www.dmi.dk/dmi/verdensvejr.htm?city=110047035&country=Norge"

NetRemote.SetVariable( 'DropDownUrls_0', 'Agderposten' );
NetRemote.SetVariable( 'DropDownUrls_1', 'AV-forumet' );
NetRemote.SetVariable( 'DropDownUrls_2', 'AVS-forumet' );
NetRemote.SetVariable( 'DropDownUrls_3', 'IMDB - Internet Movie Database' );
NetRemote.SetVariable( 'DropDownUrls_4', 'Kennelsiden' );
NetRemote.SetVariable( 'DropDownUrls_5', 'Kvasir' );
NetRemote.SetVariable( 'DropDownUrls_6', 'MediaCenter-forumet' );
NetRemote.SetVariable( 'DropDownUrls_7', 'Promixis-forumet' );
NetRemote.SetVariable( 'DropDownUrls_8', 'Telefonkatalogen' );
NetRemote.SetVariable( 'DropDownUrls_9', 'Telio-forumet' );
NetRemote.SetVariable( 'DropDownUrls_10', 'Tv-programmet hos VG' );
NetRemote.SetVariable( 'DropDownUrls_11', 'VG' );
NetRemote.SetVariable( 'DropDownUrls_12', 'Været - korttidsvarsel' );
NetRemote.SetVariable( 'DropDownUrls_13', 'Været - langtidsvarsel' );
end;

function OnPanelLoad(Ringe)
SelectedPhoneNumber= {}
SelectedPhoneNumber["Tors mobil"] = "90000000"
SelectedPhoneNumber["Signe-Lills mobil"] = "91000000"

NetRemote.SetVariable( 'DropDownPhoneNumbers_0', 'Tors mobil' );
NetRemote.SetVariable( 'DropDownPhoneNumbers_1', 'Signe-Lills mobil' );
end;


function OnPanelLoad(RingeSDI)
SelectedSDIPhoneNumber= {}
SelectedSDIPhoneNumber["SDI"] = "0046890000000"
SelectedSDIPhoneNumber["Signe-Lills mobil"] = "91000000"

NetRemote.SetVariable( 'DropDownSDIPhoneNumbers_0', 'SDI' );
NetRemote.SetVariable( 'DropDownSDIPhoneNumbers_1', 'Signe-Lills mobil' );
end;

function OnVariableChange(varname,varvalue)
if (varname=='SelectedUrl') then
NetRemote.SetVariable( 'WEB1.URL', SelectedUrl[NetRemote.GetVariable('SelectedUrl')] );

elseif (varname=='SelectedPhoneNumber') then
NetRemote.SetVariable( 'Phone.Number', SelectedPhoneNumber[NetRemote.GetVariable('Selecte dPhoneNumber')] );

elseif (varname=='SelectedSDIPhoneNumber') then
NetRemote.SetVariable( 'SDIPhone.Number', SelectedSDIPhoneNumber[NetRemote.GetVariable('Sele ctedSDIPhoneNumber')] );
end;
end;

Rob H
January 7th, 2005, 08:38 AM
The first thing that leaps to mind is that you have 3 functions called OnPanelLoad - I don't think that will work terribly well.

Rename them as OnPanelLoadSURF, OnPanelLoadRinge and OnPanelLoadRingeSDI - then write an OnPanelLoad(PanelName) that calls the appropriate one based on the panel name.

Mastiff
January 7th, 2005, 08:47 AM
That goes to show that even the seemingly easy stuff is more difficult than I thought... I actually believed that the usage was OnPanelLoad(the panel that is loaded when the action takes place)...

I split them because I didn't think it would work to have them all in one function, but simply moving those the two phone functions into to the first function and have them all loaded at the same time worked. Thanks for the pointer!