addHandler to a webTextField in a container

Norman, You use a static variable in webdialog11, is that session savvy? In earlier versions it was visible in all other sessions and it was advised to not use variables defined as static variables.

no
the static is just for demonstration purposes

Norman,
dim c as new rccMMM
c.EmbedWithin(self,0,0,c.Width,c.Height)
AddHandler c.myWebTxtf.keypressed, AddressOf myHandl

I’m putting a container on the webDialog. This container rccMMM contains a textfield and a button.
When I enter something in the Textfield I would like MyHandl to treat the input when the input is ended with ‘Enter’.

Treat = test or format Textfield.text AND lookup the next Field he has to go to. If all Keyfields are all <> “” then lookup the record in the database. Check if the record on the database has not changed during input…etc.

That’s why I need I handle on keypressed.
But apparently this is a bug. This handle doesn’t work.

Apologies accepted.

FWIW you could very well call myHandl from the c.myWebTxtf event handler added in the IDE, instead of using addHandler.

Just add the control as first parameter of the call in KeyPressed

myHandl(me, Details)

That way your code won’t break if and when addhandler is repaired, but you will still get your handler method.

hmmmmmmmm …not here
I updated the project to embed things & it all seems to behave
its a very simplified version of what I believe you’re trying to achieve
this http://great-white-software.com/miscellaneous/WebFoo.xojo_binary_project.zip

Well Norman, thanks for the example and it makes my eyebrows raise.
This is what I was trying to do, but it didn’t work.

I noticed that you are using a newer version as I do. Could that be the reason? I’m using 2015r4

Just to know the time difference. In which City do you live?

Correction, stupid remark of me!!!

Of course I’m testing your example with my version of Xojo 2015r4.
Where is the difference? I have to dive again into my project.

Correction again. I didn’t sleep well past night.
If you put the addHandler in the openEvent of the Webdialog it doesn’t work.
I changed it in your example.

http://catbe.dyndns.org:800/xojo/testHandler/testHandlerCAT.xojo_binary_project

Remark:
If the Webdialog is a sheet it is almost impossible to position the objects
Therefor I use a Palette.

well theres a few things that the example will mislead you about
comment out the code in webpage1,button1 that adds the container & hooks up the events otherwise you will end up not being sure which one works

and when you do this you will see that your container gets embedded on the PAGE and NOT the dialog

that almost seems to me like a bug

but my previous example does show you that what youre trying to do can be done perhaps just not in the exact fashion you expected

maybe a shared method on the web dialog that performs the code in the order that I wrote that returns a configured web dialog that you then show would suffice

dunno but its worth a try

Like I already ascertained, it is impossible to embed the container in the sheet. Therefor I used a Palette. But whatever, it will not work at this moment, because of the potential Bug.

The only way, at this moment, is your way, to embed the containers from the calling page and not from within the Webdialog.

[h]On the other hand this is not totally true.[/h]
If webdialog.shown embed a container with a defined event, like ‘click’ or ‘doUpdate’ etc… and not keypressed which is an existing event of a control and not an event of the container

I mean:
Container + webTextField : define event EEEE as an event of the container
AddHandler cont.EEEE, addressOf hWhatever
RaiseEvent where ever in the container
or
Container + webTextField: don’t define event but
AddHandler cont.WebTextField.keypressed, AddressOf keypressed
event keypressed will raise it self, or better should raise

The first works
The second will not

my code used the keydown event of the text field

whats not working is embedding in the open event

I know that the open event of web controls is REALLY different than desktop because the control doesn’t exist on the browser at that point & that may be very relevant to this not working the way you expect

Gregs travelling for a couple days so I know he cant comment on this until he’s back

I was looking for this keydown event but I can’t find it.

This is actually not true. See my description above.
You can embed a container in the shown event of the web dialog. As long as you connect the event definition as a property of the container and not of the object in the container.

[url=http://catbe.dyndns.org:800/xojo/testHandler/testHandlerCAT2.xojo_binary_project[/url]

If you double click in the webTextfield of the red container it will do his work.

[quote=245150:@roland brouwers]
This is actually not true. See my description above.
You can embed a container in the shown event of the web dialog. [/quote]
Not sure why you’d refer to the shown event when I was talking about the open event ?
Embedding the container in the dialogs OPEN event and hooking up the events is what doesn’t seem to work
Other set ups do

So, is it a bug that it doesn’t work in the open event ? I honestly dont know - Greg can comment when he has a chance

You have options
Do it in the shown event (which as you said works)
Do it in the caller
A Shared method on the dialog that constructs the dialog & sets everything up and hooks up the handlers (which would be much like the creator doing it)
or wait until greg comments to see IF it is a bug or by design (web app and open events ARE different than desktop)