Sign up

0099 tutorial onButtonPress trouble

On macOS Catalina 10.15, Dlang 2.088.1

It keeps skipping a button name change. eg Tra,la,Tra,la,li - should be Tra,la,li,Tra,la,li (cycling properly). It often two calls to onButtonPress with only one click.

Re: 0099 tutorial onButtonPress trouble

On Fri, 24 Jan 2020 01:01:32 GMT, Joel Christensen wrote:

On macOS Catalina 10.15, Dlang 2.088.1

It keeps skipping a button name change. eg Tra,la,Tra,la,li - should be Tra,la,li,Tra,la,li (cycling properly). It often two calls to onButtonPress with only one click.

Well spotted, Joel. I'll look into it.

Re: 0099 tutorial onButtonPress trouble

On Fri, 24 Jan 2020 01:01:32 GMT, Joel Christensen wrote:

On macOS Catalina 10.15, Dlang 2.088.1

It keeps skipping a button name change. eg Tra,la,Tra,la,li - should be Tra,la,li,Tra,la,li (cycling properly). It often two calls to onButtonPress with only one click.

Try changing line #121 to:

writeln("Partner button label has changed to: ", labelNumber, ", ", newLabel);

It makes little sense, but this cleared it up for me. I'm curious if it does so for you, too.

I changed line #121 as a step toward debugging and when, after compiling, I ran it, I couldn't get it to skip again. The only explanation I can come up with is that the GTK main loop needed an extra micro-second to get back into sync. Doing this one extra little step (which amounts to about three lines of machine language) it got the delay it needed so it could properly process input. Just a guess.

Please let me know.

Re: 0099 tutorial onButtonPress trouble

On Sat, 25 Jan 2020 19:27:14 GMT, Ron Tarrant wrote:

On Fri, 24 Jan 2020 01:01:32 GMT, Joel Christensen wrote:

On macOS Catalina 10.15, Dlang 2.088.1

It keeps skipping a button name change. eg Tra,la,Tra,la,li - should be Tra,la,li,Tra,la,li (cycling properly). It often two calls to onButtonPress with only one click.

Try changing line #121 to:

writeln("Partner button label has changed to: ", labelNumber, ", ", newLabel);

It makes little sense, but this cleared it up for me. I'm curious if it does so for you, too.

I changed line #121 as a step toward debugging and when, after compiling, I ran it, I couldn't get it to skip again. The only explanation I can come up with is that the GTK main loop needed an extra micro-second to get back into sync. Doing this one extra little step (which amounts to about three lines of machine language) it got the delay it needed so it could properly process input. Just a guess.

Please let me know.

It still skips, but less.

Re: 0099 tutorial onButtonPress trouble

On Thu, 30 Jan 2020 08:55:26 GMT, Joel Christensen

It still skips, but less.

Odd. The change I posted cleared it up completely for me.

I'm stumped. Perhaps Mike has some idea why it's happening. Could you post the full source, please?

Re: 0099 tutorial onButtonPress trouble

On Thu, 30 Jan 2020 10:06:54 GMT, Ron Tarrant wrote:

On Thu, 30 Jan 2020 08:55:26 GMT, Joel Christensen

It still skips, but less.

Try changing line #107 to:

if(event.button.button == 1 && event.type != EventType.DOUBLE_BUTTON_PRESS && event.type != EventType.TRIPLE_BUTTON_PRESS)

Re: 0099 tutorial onButtonPress trouble

On Thu, 30 Jan 2020 13:35:51 GMT, Ron Tarrant wrote:

On Thu, 30 Jan 2020 10:06:54 GMT, Ron Tarrant wrote:

On Thu, 30 Jan 2020 08:55:26 GMT, Joel Christensen

It still skips, but less.

Try changing line #107 to:

if(event.button.button == 1 && event.type != EventType.DOUBLE_BUTTON_PRESS && event.type != EventType.TRIPLE_BUTTON_PRESS)

Thanks, Ron, that cleared it up.