Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-10271: Implement getZIndex on UI View #123

Merged

Conversation

dcampbell-macadamian
Copy link

Reviewer: Harut

Change Log:

  • added setZIndex and getZIndex properties to NativeControlObject
  • added zIndex to TiUIBase
  • modified tibbtest/app.js to test zindex

Test Cases:

  • build tibb
  • build tibbtest
  • run tibbtest
  • a blue label at the top should display zindex of 'Button 1' and 'Button 2'
  • default value should be 'undefined'
  • push 'Push Me' button
  • button 1 should overlap button 2
  • label at top should display:
    'ZIndex of button 1=200, ZIndex of button 2=undefined'
  • push 'Push Me' button again
  • button 2 should overlap button 1
  • label at top should display:
    'ZIndex of button 1=200, ZIndex of button 2=500'

https://jira.appcelerator.org/browse/TIMOB-10271

Reviewer: JP

Change Log:
- added setZIndex and getZIndex properties to NativeControlObject
- added zIndex to TiUIBase
- modified tibbtest/app.js to test zindex

Test Cases:
- build tibb
- build tibbtest
- run tibbtest
- a blue label at the top should display zindex of 'Button 1' and 'Button 2'
- default value should be 'undefined'
- push 'Push Me' button
- button 1 should overlap button 2
- label at top should display:
  'ZIndex of button 1=200, ZIndex of button 2=undefined'
- push 'Push Me' button again
- button 2 should overlap button 1
- label at top should display:
  'ZIndex of button 1=200, ZIndex of button 2=500'

https://jira.appcelerator.org/browse/TIMOB-10271
@@ -109,6 +109,8 @@ class NativeControlObject : public NativeProxyObject
virtual int setVisible(TiObject* obj);
virtual int setWidth(TiObject* obj);
virtual int setWindow(TiObject* obj);
virtual int setZIndex(TiObject* obj);
virtual int getZIndex(TiObject* obj);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move getZIndex higher to keep alphabetical order

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Harutyun
Copy link

Harutyun commented Aug 3, 2012

when I initialized view with zIndex e.g.

var testbutton1=Ti.UI.createButton
(
{top: 500,left:0,title: 'Button 1',zIndex:200}
);

applicatin is crashing, in NativeControlObject::setZIndex from
Q_ASSERT(parent != NULL);

@Harutyun
Copy link

Harutyun commented Aug 3, 2012

Reviewed

@dcampbell-macadamian
Copy link
Author

fixed zIndex problem during initialization

@dcampbell-macadamian
Copy link
Author

issues addressed

@Harutyun
Copy link

Harutyun commented Aug 8, 2012

if we modify js script's mybutton.addEventLister to be:

mybutton.addEventListener
(
'click',
function(e)
{
e.source.title='Pushed!';
if(testbutton1.zIndex===undefined)
{
testbutton2.zIndex=200;
}
else
{
if(testbutton2.zIndex===undefined)
{
testbutton2.zIndex=10;
}
}
}
);

On the second click, second button should go back, and third button should appear on front.

{
int myIndex = parent->indexOf(container_);
Q_ASSERT(parent->count() > 0);
for (int i = parent->count() - 1; i > myIndex; i--)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should iterate through all the containers:
In case if zIndex is smaller than the previous value, we should put it back (smaller index).

@Harutyun
Copy link

Harutyun commented Aug 8, 2012

reviewed

@dcampbell-macadamian
Copy link
Author

fixed loop to insert at the correct location

@dcampbell-macadamian
Copy link
Author

changed to use common function for calculating zorder

@dcampbell-macadamian
Copy link
Author

patch updated

@Harutyun
Copy link

Harutyun commented Aug 9, 2012

Approved

dcampbell-macadamian added a commit that referenced this pull request Aug 9, 2012
TIMOB-10271: Implement getZIndex on UI View
@dcampbell-macadamian dcampbell-macadamian merged commit 4c141d0 into Macadamian:blackberry Aug 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants