Srini
3/21/2002 2:49:00 PM
I am running into the same problem with MMIT. I fix something, it breaks
something else. Looks like we will endup writing adapters and text writers
from the scratch !.
"Dan Black" <thecrusher@wk.com> wrote in message
news:#YAIb9G0BHA.2300@tkmsftngp03...
> While I haven't been able to even get this to work yet, I wanted to have
> different SoftKeyLabels for each link in the list. Is this also possible?
> The code given here sets one SoftKeyLabel for the entire list.
>
> Thanks, Dan
>
> "Jeremy Bostron (MS)" <jerbosonline@microsoft.com> wrote in message
> news:wIuTuBVyBHA.2048@cpmsftngxa07...
> > Steve,
> > In version 1 there is not a property available that allows this
directly,
> > however you can extend the Microsoft Mobile Internet Toolkit (MMIT) to
do
> > this. This is done by modifying the adapter files to support a softkey
> > property on the List control. The adapter files perform all of the
> > rendering for the mobile controls and ship with MMIT. This means that
you
> > as a developer can modify the rendering, recompile the adapters, and add
> > the new functionality into your application without changing any of your
> > aspx pages. There is a sample in the MMIT Documentation called
> > "Walkthrough: Adding Support For Devices" that walks through the needed
> > steps to create a custom set of adapters. Since the walkthrough does
not
> > address how to set the softkey on a list control I have included some
> > additional information below to help you.
> >
> > In the WmlListAdapter.cs file you will need to make a modification in
the
> > render function. In the render function you will find an if statement
> that
> > checks to see if the itemsAsLinks property is set to true. If it is set
> to
> > true then a function called RenderLink is called. The 3rd argument of
the
> > RenderLink call is normally set to "null", but if we change this
property
> > we can change the value of the Left Softkey. I can use
IAttributeAccessor
> > to read custom attributes that are set on a control. Below is the code
> > change that you will need to make to the itemsAsLinks section of the
> Render
> > function:
> >
> >
> > if (itemsAsLinks)
> > {
> > String customSoftkey =
> > ((IAttributeAccessor)Control).GetAttribute("SoftkeyLabel");
> >
> > // Original RenderLink function call
> > // RenderLink(writer, item.Value, null, false, false, item.Text, true);
> >
> > // New RenderLink function call
> > RenderLink(writer, item.Value, customSoftkey, false, false, item.Text,
> > true);
> >
> > }
> >
> > Below is an example of how to set the SofkkeyLabel that is used by the
> > previous code above:
> >
> > <mobile:List id="List1" runat="server" SoftkeyLabel="Test"
> > ItemsAsLinks="True">
> > <Item Value="mobilewebform2.aspx" Text="Page 2"></Item>
> > <Item Value="mobilewebform3.aspx" Text="Page 3"></Item>
> > <Item Value="mobilewebform4.aspx" Text="Page 4"></Item>
> > </mobile:List>
> >
> > You will also need to modify the UPWmlMobileTextWriter.cs file since it
> > provides the rendering for UP browsers. The easy part is that you can
> > leverage the work done above. In that file you will find a function
called
> > "RenderBeginHyperlink", notice that the third argument passed to this
> > function is softkeyLabel. This private value will contain the value set
> > from the previous code examples. You will need to pass this value to
the
> > OpenMenu function that is called from the RenderBeginHyperlink function.
> > Below is an example:
> >
> > // Original OpenMenu function call
> > // OpenMenu();
> >
> > // New OpenMenu function call
> > OpenMenu(softkeyLabel);
> >
> > The OpenMenu function call contained in the RenderBeginPostBack function
> > will also need to be changed to include the softkeyLabel argument:
> > // Original OpenMenu function call
> > // OpenMenu();
> >
> > // New OpenMenu function call
> > OpenMenu(softkeyLabel);
> >
> > Locate the OpenMenu() function and ad an argument to handle the softkey
> > label name that is going to be passed to it. Below is an example:
> > // Original OpenMenu function declaration
> > // private void OpenMenu()
> >
> > // New OpenMenu function declaration
> > private void OpenMenu(string softkeyLabel)
> >
> > Within the OpenMenu function you will find a local variable declared
> called
> > GoLabel. This is the variable that you need to pass the name of our
> > softkey to. Below is the code example:
> >
> > // Original code to set the GoLabel value
> > //String GoLabel =
> > Adapters.SR.GetString(Adapters.SR.WmlMobileTextWriterGoLabel);
> >
> > // New code to set the GoLabel value
> > String GoLabel = softkeyLabel;
> >
> > if(GoLabel == null)
> > GoLabel =
> > Adapters.SR.GetString(Adapters.SR.WmlMobileTextWriterGoLabel);
> >
> > Once all of these changes are in place you will need to perform the
> > following sections in the MMIT document called "Walkthrough: Adding
> Support
> > for Devices":
> > Creating a New Assembly
> > Configuring the Web Application
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> > Thanks,
> > Jeremy Bostron
> > Microsoft Support
> > --------------------
> > When a list control is displayed in WML as links, the softkey value is
> "Go".
> > Where can this be changed?
> >
> > Thanks
> > Steve
> >
> >
> >
> >
>
>