Big help

hey guys. all good?

I have a question and I will try to explain it here.

i’m doing my first iOS app. it’s simple. but i’m strugling to understand how to do it.

i have:
msHome (mobileScreen named home)
ScrollableArea1 (MobileScrollableArea with a container (behavior))
tblEvents (iOSMobileTable)

this container has a “mivs” subclass of a “miv” subclass of MobilelmageViewer

on miv (will use on other projects), i have a pressed event
on mivs (specific for this project), i have another pressed event that SHOULD change the tblEvents…

but i can’t change…

how can i change the tblEvents content from “outside” the parent mobileScreen?

thanks!

alex

DASports example.xojo_binary_project.zip (10.9 KB)

Looks like you need the Observer pattern.

iOSkit has an example of that called JKNotificationCenter

Tks!

I downloaded and tried to run, but there are some bugs on code.

I’ll keep looking for an easy solution. I don’t know, in fact, if the xojo IDE is unable to do this, or if this is a normal behavior (and i don’t know how to do it)

Alex

Open the project, copy the JKNotificationCenter module to your existing project. Then you can use it immediately. That module is pure Xojo code and will work straight away

You can look through the iOSKit project to see an example of how to use the notification module, but it’s in general very simple. You’ll define a method for receiving the notification within the view that has your tblEvents and do your update from there

1 Like

sorry, didn’t get. with my xojo skills, i’ll not go so far…

could you please make an example on my project?

i’m sure with an example i’ll understand and go further.

i don’t want to make a “gambiarra” (makeshift)
i could, for example, put a timer to pull the information updated…
It would certainly solve the problem, but it’s not the right way to do it.

DASports example.xojo_binary_project.zip (13.3 KB)

I’m not sure how you didn’t get it. It’s literally just open the iOSKit project, copy the module, paste it into your project. Try it again, I bet you can figure it out

If you need an example you should still be able to access this one from a while back Working on first iOS in-app purchase app... questions - #26 by Jason_King

yes, i did it. do not know where to manage the send/receive method.

i looked the example… i didn’t understand how to use it on my project to “add.row” from external method.

i think i didn’t explain correctly.

i have this (new example, same question):

an the pressed event of a button is inside a container.

it does not work… and i can understand why it does not work.
i just don’t know how to make it works.

alex

People will say this is bad design, but it may help:

Add to the App object, 3 public properties

TheHome as msHome
TheScrollableArea as MobileScrollableArea
TheTable as iOSMobileTable

As each of them open, add in the Opening event code like this for mshome:

app.Thehome = me

Then, anywhere else in your app you can do this:

if app.Thehome <> nil then

app.Thehome.someproperty = somevalue

end if




1 Like

Yes, I had thought about doing that…

I’ll implement it just for testing purposes, but there must be a more elegant way to do it…

Or not!

thank you for your help. i’ll still wait for another solution, if has.

alex

You can do following:

  • Create an Event Defintion in Container1 e.g. ButtonPressed with parameter value as String
  • In the Pressed event of the Button1 you do RaiseEvent ButtonPressed "text"
  • In Screen1 you now have a ButtonPressed event in Container11
  • In that event you can add the code Label1.text = value

This should work.

1 Like

didn’t work…

image

RaiseEvent is what you need to use here.

ohhh…rsrsrs

worked!

Hi @PaulS

I need the same thing, but i need to put this container1 inside a MobileScrollableArea…

is it possible?

I’m not familiar with iOS development in Xojo.

But I assume it should work in the MobileScrollableArea too.

Maybe you have to add a PressedButton Event Definition in MobileScrollableArea and add a RaiseEvent in the PressedButton event of container1 inside a MobileScrollableArea.

That would give you again the PressedButton event in screen1.

With other words. You can keep using RaiseEvent until you are at the level where you want to do something with that event.

didn’t work

test_paulS.xojo_binary_project.zip (6.5 KB)

As mentioned before I’m not familiar with iOS development in Xojo.

When I look at the test program, I see that Container1 is added to alemac_MobileScrollableArea in Screen1. Container1 isn’t added to alemac_MobileScrollableArea itself. Therefore there is no ButtonPressed event available in alemac_MobileScrollableArea.

Unfortunately my solution isn’t going to work in iOS when using a MobileScrollableArea.