Author Topic: radio controls error  (Read 8277 times)

sparkythex

  • Newbie
  • *
  • Posts: 43
radio controls error
« on: January 05, 2011, 06:33:14 AM »
I was playing with the example CanvasFieldEvents

what i have is 3 radio controls. (r3, r4, r5)
they should correspond to some fields f3, f4, f5. (if it maters on the CanvasFieldEvents it has 8 fields i left it that way.)
so what i want to have happen is when field 3 is clicked it will set radio 3 as selected.
like wise when f4 or f5 will update associated r4 or r5.
but also vise-versa i want when f3, or f4 or f5 is clicked on it will set correspond radio selected.

now when i click on the radio it will adjust color & leave selected the radio.
however when i click on the field it will remove selection from last radio but it doesn't set corresponding radio selected.
so none of the radios have selection.

after playing with this it seems to setting radio to selected state but it like doesn't update the screen.
because after closing the app & reopening the app it shows what should have been the last radio selected as still selected.
example is if click radio 3 it shows dot selected if then click r4 it shows selected & the field box correspond gets focus.
however i click on field5 all radios show as not selected.
however if close & reopen it shows r5 as selected.

because it seems to show what should be last selected correctly, I really can't find anything wrong with the code & it looks like it is tracking everything properly.
it seems like some sort of video refresh issue.


i was playing with the example CanvasFieldEvents pretty sure i left it as was with the exception of the radios.
oh and the starting color, set all fields to white so only active field turns yellow.
here is my code adjustments.
Code: [Select]
Local fid,evnum,mess,fset

Put fnum into fid

Put FieldEventFN(fid) into evnum

Put fid into mess
Put evnum after mess
Put mess into field 7

@@@@ should track events for == 1 - Mouse Down:  The mouse button was pressed within the field.
If evnum=1 Then
@@@@@@ not working & don't know why
    Put 'Field ' into mess
    Append fid onto mess
    Append ' was click' onto mess
    SayNow mess
    GotoLabel 1
@@@@@@ not working & don't know why
EndIf

@@@@ should track  events for == 2 - Mouse Up:  The mouse button was released within the field.
If evnum=2 Then
@@@@@@ not working & don't know why
    Put 'Field ' into mess
    Append fid onto mess
    Append ' was click' onto mess
    SayNow mess
    GotoLabel 1
@@@@@@ not working & don't know why
EndIf

If evnum=5 Then
    for fset=1 to 6
        @ sets to white
       FieldPaperColor   fset,255,255,255
    endfor
    Put 'Field ' into mess
    Append fid onto mess
    SayNow mess
    @ set to yellow
    FieldPaperColor   fid,255,255,0
    @set last card clicked
    @@@put
    @ put radio active
         if fid=3 then
           RadioSetState 3,1
          endif
         if fid=4 then
           RadioSetState 4,1
          endif
         if fid=5 then
           RadioSetState 5,1
          endif
@@@@@ mental note this fails
@@@@ RadioSetState fid,1

     @@Gives the focus to the specified field.
      FieldGiveFocus fid

    GotoLabel 1
EndIf

If evnum=7 Then
    Put FieldKeyDownFN into field 8
EndIf

label 1

i have it separated in app but here is what i have on each filed (listed it all together but seperated by "@@@@")
Code: [Select]
@@@ for fields 3 to 5 only
RadioSetState 3,1
Call FieldAction(3)
@@@@@@@@@@@
RadioSetState 4,1
Call FieldAction(4)
@@@@@@@@@@@
RadioSetState 5,1
Call FieldAction(5)
@@@@@@@@@@@

likewise here is what i have on my radio buttons
Code: [Select]
@@@ for radio3
local fset
    for fset=1 to 6
        @ sets to white
       FieldPaperColor   fset,255,255,255
    endfor

@ yellow = 255,255,0
FieldPaperColor   3,255,255,0
 FieldGiveFocus 3
@@@@@@@@@@@
@@@ for radio4
local fset
    for fset=1 to 6
        @ sets to white
       FieldPaperColor   fset,255,255,255
    endfor

@ yellow = 255,255,0
FieldPaperColor   4,255,255,0
 FieldGiveFocus 4
@@@@@@@@@@@
@@@ for radio5
local fset
    for fset=1 to 6
        @ sets to white
       FieldPaperColor   fset,255,255,255
    endfor

@ yellow = 255,255,0
FieldPaperColor   5,255,255,0
 FieldGiveFocus 5
@@@@@@@@@@@

the most important thing right now is the lost selection on radio buttons i think
however
  if you will notice in the field control i have it working off event 5 which is mouse movement.
this was jsut how i was able to get it to work as you can see i noted event 1 & event2 not working. (you probably know but that is for the mouse click down or release. to me i don't care which works for what iam doing it doesn't matter i know some times you can care but not for what i am doing.)
I was able to get it to work how i want but i would rather it work off a click as i have a lot of buttons at the top & so if they move mouse to those but go over any of other fields, it could mess with which field should be updated if they go over a field instead of around the field.  my goal is to have text inserted in to the last/currently yellow field.
i suppose if i had to choose; i would pick the mouse up (event2) so i know they are done & have selected field they want.  example i guess would be if they highlight some existing text in field to select it. (but not sure to me it seems like it is the same or i regard the whole process  of clicking down & lifting up as one process. even if draging & dropping stuff.)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 460
  • Here to help you
Re: radio controls error
« Reply #1 on: January 06, 2011, 01:29:05 PM »
Quote from: "sparkythex"
I was playing with the example CanvasFieldEvents

what i have is 3 radio controls. (r3, r4, r5)
they should correspond to some fields f3, f4, f5. (if it maters on the CanvasFieldEvents it has 8 fields i left it that way.)
so what i want to have happen is when field 3 is clicked it will set radio 3 as selected.
like wise when f4 or f5 will update associated r4 or r5.
but also vise-versa i want when f3, or f4 or f5 is clicked on it will set correspond radio selected.

now when i click on the radio it will adjust color & leave selected the radio.
however when i click on the field it will remove selection from last radio but it doesn't set corresponding radio selected.
so none of the radios have selection.

after playing with this it seems to setting radio to selected state but it like doesn't update the screen.
because after closing the app & reopening the app it shows what should have been the last radio selected as still selected.
example is if click radio 3 it shows dot selected if then click r4 it shows selected & the field box correspond gets focus.
however i click on field5 all radios show as not selected.
however if close & reopen it shows r5 as selected.

because it seems to show what should be last selected correctly, I really can't find anything wrong with the code & it looks like it is tracking everything properly.
it seems like some sort of video refresh issue.

Yes, you have found a radio button refresh bug - many thanks for reporting it.

A workaround is to disable the radio button and then enable it again :-

Code: [Select]
@ force refresh for radiobutton 5
RadioSetMode(5,0)
RadioSetMode(5,1)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

sparkythex

  • Newbie
  • *
  • Posts: 43
Re: radio controls error
« Reply #2 on: January 08, 2011, 06:56:14 AM »
Quote from: "Malkom"
Yes, you have found a radio button refresh bug - many thanks for reporting it.

A workaround is to disable the radio button and then enable it again :-

Code: [Select]
@ force refresh for radiobutton 5
RadioSetMode(5,0)
RadioSetMode(5,1)

I am guessing i would replace the radio sets

 what i have on field
Code: [Select]
@@@@@@@@@@@
@  changing >>>>> @@@@ RadioSetState 5,1
@@ to ...
RadioSetMode(5,0)
RadioSetMode(5,1)
Call FieldAction(5)
@@@@@@@@@@@
this doesn't seem RadioSetMode make a change
I have tried it both ways with just the set &  the set+mode
Code: [Select]
RadioSetState 5,1
RadioSetMode(5,0)
 RadioSetMode(5,1)


what about the mouse event part is that a bug too?
Quote
 if you will notice in the field control i have it working off event 5 which is mouse movement.
this was jsut how i was able to get it to work as you can see i noted event 1 & event2 not working. (you probably know but that is for the mouse click down or release. to me i don't care which works for what I'm doing it doesn't matter i know some times you can care but not for what i am doing.)
I was able to get it to work how i want but i would rather it work off a click as i have a lot of buttons at the top & so if they move mouse to those but go over any of other fields, it could mess with which field should be updated if they go over a field instead of around the field.  my goal is to have text inserted in to the last/currently yellow field.
i suppose if i had to choose; i would pick the mouse up (event2) so i know they are done & have selected field they want.  example i guess would be if they highlight some existing text in field to select it. (but not sure to me it seems like it is the same or i regard the whole process  of clicking down & lifting up as one process. even if dragging & dropping stuff.)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 460
  • Here to help you
Re: radio controls error
« Reply #3 on: January 12, 2011, 07:24:52 AM »
Quote from: "sparkythex"
Quote from: "Malkom"
Yes, you have found a radio button refresh bug - many thanks for reporting it.

A workaround is to disable the radio button and then enable it again :-

Code: [Select]
@ force refresh for radiobutton 5
RadioSetMode(5,0)
RadioSetMode(5,1)

I am guessing i would replace the radio sets

 what i have on field
Code: [Select]
@@@@@@@@@@@
@  changing >>>>> @@@@ RadioSetState 5,1
@@ to ...
RadioSetMode(5,0)
RadioSetMode(5,1)
Call FieldAction(5)
@@@@@@@@@@@
this doesn't seem RadioSetMode make a change
I have tried it both ways with just the set &  the set+mode
Code: [Select]
RadioSetState 5,1
RadioSetMode(5,0)
 RadioSetMode(5,1)



I've tried the code on both Macintosh and Windows and it forced the radiobutton refresh - not sure why it isn't working in your code




Quote from: "sparkythex"
what about the mouse event part is that a bug too?

  if you will notice in the field control i have it working off event 5 which is mouse movement.
this was jsut how i was able to get it to work as you can see i noted event 1 & event2 not working. (you probably know but that is for the mouse click down or release. to me i don't care which works for what I'm doing it doesn't matter i know some times you can care but not for what i am doing.)
I was able to get it to work how i want but i would rather it work off a click as i have a lot of buttons at the top & so if they move mouse to those but go over any of other fields, it could mess with which field should be updated if they go over a field instead of around the field.  my goal is to have text inserted in to the last/currently yellow field.
i suppose if i had to choose; i would pick the mouse up (event2) so i know they are done & have selected field they want.  example i guess would be if they highlight some existing text in field to select it. (but not sure to me it seems like it is the same or i regard the whole process  of clicking down & lifting up as one process. even if dragging & dropping stuff.)

Yes, its a bug as the MouseUp event is not firing on either Windows or Macintosh.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

sparkythex

  • Newbie
  • *
  • Posts: 43
Re: radio controls error
« Reply #4 on: January 12, 2011, 07:56:50 AM »
Quote from: "Malkom"
Quote from: "sparkythex"
Quote from: "Malkom"
Yes, you have found a radio button refresh bug - many thanks for reporting it.

A workaround is to disable the radio button and then enable it again :-

Code: [Select]
@ force refresh for radiobutton 5
RadioSetMode(5,0)
RadioSetMode(5,1)

I've tried the code on both Macintosh and Windows and it forced the radiobutton refresh - not sure why it isn't working in your code
I tried it again with just RadioSetMode(5,0) & RadioSetMode(5,1)
you are correct it does work that way.  I really don't know why it didn't work before.  I did reboot since my last post.  Reboot is the magic cure all!!!!



Quote from: "sparkythex"
what about the mouse event part is that a bug too?

  if you will notice in the field control i have it working off event 5 which is mouse movement.
this was just how i was able to get it to work as you can see i noted event 1 & event2 not working. (you probably know but that is for the mouse click down or release. to me i don't care which works for what I'm doing it doesn't matter i know some times you can care but not for what i am doing.)
I was able to get it to work how i want but i would rather it work off a click as i have a lot of buttons at the top & so if they move mouse to those but go over any of other fields, it could mess with which field should be updated if they go over a field instead of around the field.  my goal is to have text inserted in to the last/currently yellow field.
i suppose if i had to choose; i would pick the mouse up (event2) so i know they are done & have selected field they want.  example i guess would be if they highlight some existing text in field to select it. (but not sure to me it seems like it is the same or i regard the whole process  of clicking down & lifting up as one process. even if dragging & dropping stuff.)

Yes, its a bug as the MouseUp event is not firing on either Windows or Macintosh.
aaauuuggg!!!
  so if MouseUp doesn't work what about mouse down or mouse click?
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 460
  • Here to help you
Re: radio controls error
« Reply #5 on: January 12, 2011, 09:31:52 PM »
As an alternative to an EditField perhaps you could use a Canvas as the mouse events including both MouseUp and MouseDown are working.

Canvases have a range of commands/functions for displaying text. Once you know where the mouse event occurred then you could check the data structure holding the text and work out which word was clicked and so form a bold tag.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

sparkythex

  • Newbie
  • *
  • Posts: 43
Re: radio controls error
« Reply #6 on: January 13, 2011, 05:03:48 AM »
Quote from: "Malkom"
As an alternative to an EditField perhaps you could use a Canvas as the mouse events including both MouseUp and MouseDown are working.

Canvases have a range of commands/functions for displaying text. Once you know where the mouse event occurred then you could check the data structure holding the text and work out which word was clicked and so form a bold tag.

I don't really care how it is done.
but I am not sure I understand  how to link the canvas to the field.
how do do you handle new text entered in if canvas covers the field?

can you let me have a simple example.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

 

anything