I am very proud to show you our available apps in SamsungApps Store (much more coming soon):
[UK]
1. Color It
2. Tangram
3. Quick Recipe
4. Dot to Dot
5. Zodiac
6. Kanjis
7. RSS Pocket
8. Appetizer bowl
9. Ballon Art
10. Trip$
11. Timetable for Children
12. My Kite
13. Chess Adventure
14. Namasté
15. My Name
16. Crazy Horn
17. Magnit
[Brazil]
1. Minha Pipa
2. Agenda dos Filhos
3. Pintando o 7
4. Receita Rapida
5. Liga Pontos
6. Kanjis
7. Zodiac
8. Petisqueira
9. Balão Arte
10. Guia Aereo
11. Viagens
12. Desafio Xadrez
13. Meu Nome
14. Namasté
15. Magnit
16. Tangram
17. RSS Pocket
Highlights
My Kite and Timetable for Children
Tangram
RSS Pocket
RSS Pocket [PT]
Agenda dos Filhos e Minha Pipa [PT]
All of these apps are FREE and available in English/Spanish/Portuguese! Enjoy! :)
Thanks for your visit! :)
Next post: bada i18n
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
segunda-feira, 21 de fevereiro de 2011
OnDraw (void);
Do you want to present images on your screen?
Lets see a simple code example:
If you need to present your image in other Form, you must overload OnDraw function.
OnDraw(void) is called when container needs to draw itself. Users can override this method to display user-specific drawings. This method is called after the container has drawn itself, but just before the container draws its child controls.
Thanks for your visit! :)
Next post: C.E.S.A.R Internship bada apps
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
Lets see a simple code example:
void
FormMain::showImage(){
result r = E_SUCCESS;
// img
Image* pImg = null;
//path to your img
this->__imgPath = "/Res/Images/pista.png";
pImg = new Image();
r = pImg->Construct();
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
//Create a Bitmap == Osp::Graphics::Bitmap * __pBitmap1;
this->__pBitmap1 = pImg->DecodeN(this->__imgPath,
BITMAP_PIXEL_FORMAT_ARGB8888);
r = GetLastResult();
TryCatch(null != __pBitmap1 && r == E_SUCCESS,
,GetErrorMessage(r));
return;
CATCH:
SetLastResult(r);
AppLog("[%s] - Failed to initialize an instance of Image",
GetErrorMessage(r));
if (pImg != null) {
delete pImg;
pImg = null;
}
return;
}
If you need to present your image in other Form, you must overload OnDraw function.
OnDraw(void) is called when container needs to draw itself. Users can override this method to display user-specific drawings. This method is called after the container has drawn itself, but just before the container draws its child controls.
Thanks for your visit! :)
Next post: C.E.S.A.R Internship bada apps
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
quinta-feira, 3 de fevereiro de 2011
form manager - how to switch forms in bada apps (part 2)
As we've learned, FormMgr is another Form in the application responsible for Forms management. The FormMgr just change screens in bada. FormMgr don't present labels, images, etc...
Steps:
1. create your Forms (Forms that app needs);


In this post I will just send an information from one Form to another (easiest way).
Note that in Forms properties you must set Form name, Labels name, Editfields names, ...
2. update application class to start with FormMgr (and not with FormMain)
3. create FormMgr.cpp and FormMgr.h
Now, let's see FormMgr code...
FormMgr.h>>
FormMgr.cpp>>
4. Link FormMgr and new Forms...
Ok, we know how to update application class to call FormMgr, understood FormMgr... Now, lets see how to call FormMgr to switch the Forms and how to receive Args.
From FormMain to FormResult: sending and presenting data texts...
FormMain.cpp>>
After sending... this parameters will be considered in void FormMgr::SwitchToForm(RequestId requestId, Osp::Base::Collection::IList* pArgs) function.
To receive the parameters, lets see FormResult example:
FormResult>>
This example is available HERE!
Thanks for your visit! :)
Next post: OnDraw(void);
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
Steps:
1. create your Forms (Forms that app needs);


In this post I will just send an information from one Form to another (easiest way).
Note that in Forms properties you must set Form name, Labels name, Editfields names, ...
2. update application class to start with FormMgr (and not with FormMain)
bool
FormManagerSample::OnAppInitializing(AppRegistry& appRegistry)
{
result r = E_SUCCESS;
FormMgr *pFormMgr = new FormMgr();
if(pFormMgr->Initialize())
{
r = Application::GetInstance()->GetAppFrame()
->GetFrame()->AddControl(*pFormMgr);
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
pFormMgr->SetStarterForm(FormMgr::REQUEST_MAINFORM,
null);
}
return true;
CATCH:
SetLastResult(r);//we'll see this soon, in next posts
return false;
}
3. create FormMgr.cpp and FormMgr.h
Now, let's see FormMgr code...
FormMgr.h>>
#ifndef _FORMMGR_H_
#define _FORMMGR_H_
#include
#include
#include
#include
#include
#include
class FormMgr :
public Osp::Ui::Controls::Form //derived from Form;
{
public:
FormMgr(void);
virtual ~FormMgr(void);
public:
bool Initialize(void);
bool SetStarterForm(RequestId requestId,
Osp::Base::Collection::IList* pArgs);
static const RequestId REQUEST_MAINFORM = 100; //Form 1
static const RequestId REQUEST_RESULTFORM = 101; //Form 2
protected:
void SwitchToForm(RequestId requestId,
Osp::Base::Collection::IList* pArgs);
Osp::Ui::Controls::Form *__pPreviousForm;
FormMain* __pMainForm; //Main Form - will send the data
FormResult* __pResultForm; //Result Form - will receive the data
public:
virtual void OnUserEventReceivedN(RequestId requestId,
Osp::Base::Collection::IList* pArgs);
};
#endif
FormMgr.cpp>>
#include "FormMgr.h"
#include "FormMain.h"
#include
#include "FormResult.h"
using namespace Osp::App;
using namespace Osp::Base;
using namespace Osp::Ui;
using namespace Osp::Ui::Controls;
FormMgr::FormMgr(void)
{
__pPreviousForm = null;
__pMainForm = null;
__pResultForm = null;
}
FormMgr::~FormMgr(void)
{
}
bool
FormMgr::Initialize(void)
{
result r = E_SUCCESS;
//FormMgr must be constructed...
r = Form::Construct(FORM_STYLE_NORMAL);
if (r != E_SUCCESS)
{
SetLastResult(r);
}else{
//and you must set a name!
SetName(L"FormMgr");
}
return r == E_SUCCESS;
}
bool FormMgr::SetStarterForm(RequestId requestId,
Osp::Base::Collection::IList* pArgs)
{
Form *pCurrentForm = Application::GetInstance()->GetAppFrame()
->GetFrame()->GetCurrentForm();
if (pCurrentForm == this)
SwitchToForm(requestId, pArgs);
else
return false;
return true;
}
void FormMgr::OnUserEventReceivedN(RequestId requestId,
Osp::Base::Collection::IList* pArgs)
{
SwitchToForm(requestId, pArgs);
}
void FormMgr::SwitchToForm(RequestId requestId,
Osp::Base::Collection::IList* pArgs)
{
result r = E_SUCCESS;
Frame *pFrame = Application::GetInstance()
->GetAppFrame()->GetFrame();
//BaseForm is adopted to facilitate a large number of Forms...
BaseForm* pBaseForm = null;
switch (requestId)
{
//MAIN FORM
case REQUEST_MAINFORM:
{
if (null == __pMainForm)
{
__pMainForm = new FormMain();
if(!__pMainForm->Initialize())
{
TryCatch(false, , GetErrorMessage(r));
}
r = pFrame->AddControl(*__pMainForm);
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
}
r = pFrame->SetCurrentForm(*__pMainForm);
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
__pMainForm->RequestRedraw(true);
if (__pPreviousForm != null) {
if (__pPreviousForm != __pMainForm)
pFrame->RemoveControl(*__pPreviousForm);
}
__pPreviousForm = __pMainForm;
break;
}
//RESULT FORM
case REQUEST_RESULTFORM:
{
FormResult* formResult = new FormResult();
if (formResult->Initialize()) {
//Passing parameters from FORMMAIN to FORMRESULT
formResult->ShowResult(pArgs);
//BaseForm is now a FormResult
pBaseForm = formResult;
}
break;
}
default:
break;
}
if (null != pBaseForm) {
//It can be used for a large number of Forms
r = pFrame->AddControl(*pBaseForm);
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
r = pFrame->SetCurrentForm(*pBaseForm);
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
pBaseForm->RequestRedraw(true);
}
if (__pPreviousForm != null) {
if (__pPreviousForm != __pMainForm)
pFrame->RemoveControl(*__pPreviousForm);
}
__pPreviousForm = pBaseForm;
if (null != pArgs) {
pArgs->RemoveAll(true);
delete pArgs;
pArgs = null;
}
return;
CATCH:
//Avoid Memory Leak
SetLastResult(r);
if(null != __pMainForm)
{
delete __pMainForm;
__pMainForm = null;
}
if(null != pBaseForm)
{
delete pBaseForm;
pBaseForm = null;
}
return;
}
4. Link FormMgr and new Forms...
Ok, we know how to update application class to call FormMgr, understood FormMgr... Now, lets see how to call FormMgr to switch the Forms and how to receive Args.
From FormMain to FormResult: sending and presenting data texts...
FormMain.cpp>>
void
FormMain::OnActionPerformed(const Osp::Ui::Control& source,
int actionId)
{
FormMgr *pFormMgr = null;
Frame *pFrame = null;
switch(actionId)
{
//If Button OK is clicked
case ID_BUTTON_OK:
{
//Get editField control
EditField * editField = static_cast(GetControl(L"IDC_EDITFIELD1"));
//Get editField content
String* strData = new String(editField->GetText());
ArrayList * list = new ArrayList;
list->Construct(1);
list->Add(*strData);
//Get Frame Instance
pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
if(null != pFrame)
{
//Get FormMgr Control
pFormMgr = static_cast(pFrame->GetControl("FormMgr"));
}
if (null != pFormMgr)
//Send an user event to FormMgr: note that
//you must say the Form to be presented and the Args.
//In this example, FormMgr will consider
//REQUEST_RESULTFORM switch case.
pFormMgr->SendUserEvent(FormMgr::REQUEST_RESULTFORM, list);
break;
}
default:
break;
}
}
After sending... this parameters will be considered in void FormMgr::SwitchToForm(RequestId requestId, Osp::Base::Collection::IList* pArgs) function.
To receive the parameters, lets see FormResult example:
FormResult>>
void
FormResult::ShowResult(Osp::Base::Collection::IList * pArgs)
{
String * strResultFromFormMain = static_cast<String*>
(pArgs->GetAt(0));
Label * lblResultado = static_cast<Label *>
(GetControl(L"IDC_LABEL1"));
lblResultado->SetText(*strResultFromFormMain);
}
This example is available HERE!
Thanks for your visit! :)
Next post: OnDraw(void);
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
form manager - how to switch forms in bada apps (part 1)
In general, I don't like large posts, but I'm intending to facilitate things here :)
Form Manager will be detailed in two posts :)
We've seen a lot of bada concepts, bada environment, bada tools, bada docs and we've seen a first bada app.
Now, let's see how to switch forms in bada...
What are Forms?
The Form provides the top level container with an indicator bar, soft key, and title bar. It is attached to a Frame. The Frame provides the main window for an application. There can be only 1 frame, however we can have a lot of forms in bada.
As your applications become more complex, it won't be enough to have one form only.
Let's start creating a new Form Manager Sample Code...
As we know, we must create a bada Form Based Project




And after these steps, we'll see our project in workspace.

If you ckeck the code into the header (FormMain.h) you'll see the declaration of the form's class.
Every Form are derived from Osp::Ui::Controls::Form.
The Form is created in FormMain.cpp, on Initialize() function.
Note that the construct parameter refers to Form name, that could be updated in Form properties, as shown below.
Once you have your form’s class ready, you will need to show it somehow to the user. For such purposes we have to go to the application's class. The FormMain.cpp, in this example, is not the main class of the project so it must be explicity initialized. When we create a bada project, the class that has the exact name of the project is the main class of the project (application class). In this example, FormManagerSample is the application class.
In FormManagerSample.cpp, you can find a callback function which is called on application’s start: OnAppInitializing()
And... if you need a lot of Forms (screens)?
Bada suggests FormMgr (code is available in SDK_FOLDER\workspace\UiControls\src\FormMgr.cpp). You can just add UiControls project to your workspace by accessing "bada SDK Samples" view (as shown here).
What is FormMgr?
Another Form in the application responsible for Forms management. The FormMgr just change screens in bada. FormMgr don't present labels, images, etc...
Let's better understand FormMgr in next post!
Thanks for your visit! :)
Next post: Form Manager - how to switch forms in bada apps (part 2)
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
Form Manager will be detailed in two posts :)
We've seen a lot of bada concepts, bada environment, bada tools, bada docs and we've seen a first bada app.
Now, let's see how to switch forms in bada...
What are Forms?
The Form provides the top level container with an indicator bar, soft key, and title bar. It is attached to a Frame. The Frame provides the main window for an application. There can be only 1 frame, however we can have a lot of forms in bada.
As your applications become more complex, it won't be enough to have one form only.
Let's start creating a new Form Manager Sample Code...
As we know, we must create a bada Form Based Project




And after these steps, we'll see our project in workspace.

If you ckeck the code into the header (FormMain.h) you'll see the declaration of the form's class.
class FormMain :
public Osp::Ui::Controls::Form,
public Osp::Ui::IActionEventListener
{
Every Form are derived from Osp::Ui::Controls::Form.
The Form is created in FormMain.cpp, on Initialize() function.
bool
FormMain::Initialize()
{
// Construct an XML form
Construct(L"IDF_FORMMAIN");
return true;
}
Note that the construct parameter refers to Form name, that could be updated in Form properties, as shown below.
Once you have your form’s class ready, you will need to show it somehow to the user. For such purposes we have to go to the application's class. The FormMain.cpp, in this example, is not the main class of the project so it must be explicity initialized. When we create a bada project, the class that has the exact name of the project is the main class of the project (application class). In this example, FormManagerSample is the application class.
In FormManagerSample.cpp, you can find a callback function which is called on application’s start: OnAppInitializing()
bool
FormManagerSample::OnAppInitializing(AppRegistry& appRegistry)
{
// TODO:
// Initialize UI resources and application
// specific data.
// The application's permanent data and context
//can be obtained from the appRegistry.
//
// If this method is successful, return true;
//otherwise, return false.
// If this method returns false, the application
// will be terminated.
// Uncomment the following statement to listen to
//the screen on/off events.
//PowerManager::SetScreenEventListener(*this);
// Create a form
FormMain *pFormMain = new FormMain();
pFormMain->Initialize();
// Add the form to the frame
Frame *pFrame = GetAppFrame()->GetFrame();
pFrame->AddControl(*pFormMain);
// Set the current form
pFrame->SetCurrentForm(*pFormMain);
// Draw and Show the form
pFormMain->Draw();
pFormMain->Show();
return true;
}
And... if you need a lot of Forms (screens)?
Bada suggests FormMgr (code is available in SDK_FOLDER\workspace\UiControls\src\FormMgr.cpp). You can just add UiControls project to your workspace by accessing "bada SDK Samples" view (as shown here).
What is FormMgr?
Another Form in the application responsible for Forms management. The FormMgr just change screens in bada. FormMgr don't present labels, images, etc...
Let's better understand FormMgr in next post!
Thanks for your visit! :)
Next post: Form Manager - how to switch forms in bada apps (part 2)
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo
Assinar:
Postagens (Atom)