# Session and webpage issues

**URL:** <https://forum.xojo.com/t/session-and-webpage-issues/11674>\
**Category:** Web\
**Created:** [October 16, 2013, 4:26am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674 "2013-10-16T04:26:25Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 16, 2013, 4:26am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/1 "2013-10-16T04:26:25Z")

</div>

I’ve got two webpages, cc and ccipad. In session, I’ve got a property called c as webpage.

in session.open I’ve got c = cc.

The problem is that any method, whether in session or cc, returns a item does not exist error. (c.lstRoutine.Cell(row,3) for example).

any suggestions? please … please realize I’m not a professional programmer like you guys.

---

<div class="post-metadata">

**Author:** ![Brad\_Hutchings](https://forum.xojo.com/user_avatar/forum.xojo.com/brad_hutchings/32/143_2.png) [@Brad\_Hutchings](https://forum.xojo.com/u/Brad_Hutchings)\
**Post date:** [October 16, 2013, 7:22am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/2 "2013-10-16T07:22:10Z")

</div>

You need to cast c. Assuming property c as WebPage:

`if c isa cc then
   cc(c).lstRoutine.Cell(row, 3) = ...
elseif c isa ccipad
   ccipad(c).lstRoutine.Cell(row, 3) = ...
end if`

---

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 17, 2013, 2:33am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/3 "2013-10-17T02:33:38Z")

</div>

That sounds backward. Using the below example, page0 is supposed to represent either webPage1 or webPage2, depending on the platform. If webPage1 is chosen, webPage1 is shown and “hi” is written in label1.

However I get a “this item doesn’t exist” error.

(can’t seem to insert an image here)

Session  
Open:  
page0 = webPage1  
page0.show

page0.label1.text = “hi”

Properties:  
page0 as webpage

webpage1 as webpage  
controls  
Label1 as txtLabel

webpage2 as webpage  
controls  
Label1 as txtLabel

---

<div class="post-metadata">

**Author:** ![Brad\_Hutchings](https://forum.xojo.com/user_avatar/forum.xojo.com/brad_hutchings/32/143_2.png) [@Brad\_Hutchings](https://forum.xojo.com/u/Brad_Hutchings)\
**Post date:** [October 17, 2013, 3:07am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/4 "2013-10-17T03:07:07Z")

</div>

OK, well, I was working with what you gave us. YMMV.

---

<div class="post-metadata">

**Author:** ![Phillip\_Zedalis](https://forum.xojo.com/user_avatar/forum.xojo.com/phillip_zedalis/32/1151_2.png) [@Phillip\_Zedalis](https://forum.xojo.com/u/Phillip_Zedalis)\
**Post date:** [October 17, 2013, 3:11am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/5 "2013-10-17T03:11:55Z")

</div>

[quote=40875:@John Scanlan]That sounds backward. Using the below example, page0 is supposed to represent either webPage1 or webPage2, depending on the platform. If webPage1 is chosen, webPage1 is shown and “hi” is written in label1.

However I get a “this item doesn’t exist” error.

(can’t seem to insert an image here)

Session  
Open:  
page0 = webPage1  
page0.show

page0.label1.text = “hi”

Properties:  
page0 as webpage

webpage1 as webpage  
controls  
Label1 as txtLabel

webpage2 as webpage  
controls  
Label1 as txtLabel[/quote]

webPage1 and WebPage are distinct classes. WebPage does not have a reference to Label1 but webPage1 does. So if you are going to store a reference to the base class (WebPage) then Brad is correct you will need to cast. The reason is that whatever code accessing the page0 property does not know whether its a webPage1/webPage2/WebPage and will assume the latter (what you defined it as).

---

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 17, 2013, 3:21am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/6 "2013-10-17T03:21:09Z")

</div>

So you’re saying that I can’t use single code to do things in different window layouts depending on the platform … I think.

Something like if page0 = webpage1 then else end if will end up repeating all the code. That’s what I’m trying to avoid. Brad’s suggestion makes sense but repeats code in the same way. I’m afraid this is going to become a huge app.

My app is code heavy out of necessity ([http://sfo1.sc1473a.1701hosting.com/cgi-bin/rio/rio.cgi](http://sfo1.sc1473a.1701hosting.com/cgi-bin/rio/rio.cgi)).

or am I missing something? probably something basic?

---

<div class="post-metadata">

**Author:** ![Phillip\_Zedalis](https://forum.xojo.com/user_avatar/forum.xojo.com/phillip_zedalis/32/1151_2.png) [@Phillip\_Zedalis](https://forum.xojo.com/u/Phillip_Zedalis)\
**Post date:** [October 17, 2013, 3:45am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/7 "2013-10-17T03:45:17Z")

</div>

Well one thing you can do is move all the duplicate code to a method so the if statement just calls the appropriate setup routines.

---

<div class="post-metadata">

**Author:** ![Brad\_Hutchings](https://forum.xojo.com/user_avatar/forum.xojo.com/brad_hutchings/32/143_2.png) [@Brad\_Hutchings](https://forum.xojo.com/u/Brad_Hutchings)\
**Post date:** [October 17, 2013, 3:47am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/8 "2013-10-17T03:47:05Z")

</div>

You could create a class interface and implement it in both classes. Your general approach though strikes me as too cute by half. I’d have to get my head around what you’re trying to accomplish to recommend a better route, but I have a feeling there is one.

---

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 17, 2013, 3:50am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/9 "2013-10-17T03:50:23Z")

</div>

is there a way to say do stuff in whichever page happens to be active?

---

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 19, 2013, 4:19am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/10 "2013-10-19T04:19:18Z")

</div>

any ideas yet Brad ? 🙂

---

<div class="post-metadata">

**Author:** ![Brad\_Hutchings](https://forum.xojo.com/user_avatar/forum.xojo.com/brad_hutchings/32/143_2.png) [@Brad\_Hutchings](https://forum.xojo.com/u/Brad_Hutchings)\
**Post date:** [October 19, 2013, 4:47am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/11 "2013-10-19T04:47:30Z")

</div>

You’re looking for some syntactic sugar here to deal with the reality that cc and ccipad are two different subclasses of WebPage. What exactly are the differences between cc and ccipad? And from where are you calling cc.lstRoutine(…)? The way I design stuff, I would never end up doing something like that except to implement a data push from one session to another. Maybe we can help you keep things isolated to a page and avoid the issue.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [October 19, 2013, 6:24am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/12 "2013-10-19T06:24:56Z")

</div>

> [@40889:@John Scanlan](#):
>
> is there a way to say do stuff in whichever page happens to be active?

Use a class interface like Brad suggested.

---

<div class="post-metadata">

**Author:** ![John\_Scanlan](https://forum.xojo.com/user_avatar/forum.xojo.com/john_scanlan/32/472_2.png) [@John\_Scanlan](https://forum.xojo.com/u/John_Scanlan)\
**Post date:** [October 20, 2013, 1:51am UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/13 "2013-10-20T01:51:44Z")

</div>

ipad needs much bigger buttons for fat coaches’ fingers. cc.lstRoutine is a listbox in a container control.

also trying the class interface, but when I create a class instance (c = new circleCalcRoutines) in cc, I get a c does not exist error when trying to call c.dosomething.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 4:53pm UTC](https://forum.xojo.com/t/session-and-webpage-issues/11674/14 "2020-10-29T16:53:58Z")

</div>


