Page 1 of 1

on mouseloc question

Posted: Sun Mar 23, 2014 6:01 pm
by vedus
i have 5 cards,1 btn "btnmenu" in the tab-bar.And i have a group (behave like background) for all the cards.
the btn have this code

Code: Select all

on mouseUp
  show grp "menu2" of card "basic" with visual effect scroll up very fast
    disable me
end mouseUp
and in the stack i have this code

Code: Select all

on mouseup
 if the mouseloc is not within the rect of group "menu2" then
    hide group "menu2"
    enable btn "btnmenu" of grp "tab_bar"
  end if
end mouseup
that i want is when i press the btn show up the menu and disable the btn.And when i click outside from group group, will be hided.
where i do wrong here?
The problem here is when i press the buttonthe menu is up,but the btn stay always disable it

Re: on mouseloc question

Posted: Sun Mar 23, 2014 6:54 pm
by dunbarx
Vedus.

It all looked good, and it was. The stack worked fine for me. What are you seeing?

Craig Newman

Re: on mouseloc question

Posted: Sun Mar 23, 2014 6:57 pm
by vedus
that the btn "btnmenu" is disabled always if i change card
And if i press outside the group is no hided..

Re: on mouseloc question

Posted: Sun Mar 23, 2014 7:18 pm
by dunbarx
Hi.

The enabled of the btn would not change simply because you changed cards. That property sticks.

But perhaps in the stack script:

Code: Select all

on opencard
enable btn "btnMenu"
end opencard
Now when you navigate, the button is always re-enabled. Is this what you want? In not, perhaps you can use this idea to make it happen.

Craig

Re: on mouseloc question

Posted: Sun Mar 23, 2014 9:26 pm
by vedus
thank you,still i cant make the mouseloc to work,i don't know where is wrong the script..
when i do the test in a new stack is working,when i go to original project to test it,is NO working
here is the complete code of the start stack.

Code: Select all

global mydbid
on preopenstack
  set the fullscreenmode of me to "exactfit"
    -- use switch with "the environment" property to determine if the app is running on mobile or in development
       switch the environment
          
              case "development"
                     -- set default folder
                     set the itemdel to "/"
                     set the defaultfolder to item 1 to -2 of the effective filename of this stack
                     put "data.sqlite" into tDatabase -- using a variable to store the path to the database file rather than using the path directly in revopendatabase
                     break
            case "mobile"
                     put specialfolderpath("documents") & "/data.sqlite" into tDatabase 
                     if there is not a file tDatabase then
                            put URL ("binfile:" & specialfolderpath("engine") & "/data.sqlite") into URL ("binfile:" & tDatabase)
                     end if
                     break
   end switch
  
    -- path to aagDBLib  the file. Just the stack name.
       start using stack "aagDBLib"
  
       get revOpenDatabase("sqlite",tDatabase,,,)
   
       if it is a number then
              dbSetDefaultConnectionID it
    put it into mydbid
       else
              answer error it
       end if 
  //set the accelatedRendering of this stack to true
end preopenstack

on mouseup
  if the mouseloc is not within the rect of grp "menu_1" then
    enable btn "mymenu" of grp "tab_bar"
    hide grp "menu_1"
    else
    end if
end mouseup



on openstack
  go to card startscreen
  hide group "menu_1" of card basic
end openstack