Languages

Menu
Sites
Language
TextBox and MessageBox problem

Hi all,

Suppose there are two or more TextBoxes add to my form and once the user clicks/taps on one of them, then it gets highlighted and it color is changed. This is done by inheriting the IFocusEventListener class and overidding the functions OnFocusGained(). Now i want that once the user clicks a particular button, this focus is lost and none of the textboxes should be selected just as it appears after launching the form. If it is possible then how?
 
Also i would like to know if i can make a popup/MessageBox that has as many buttons as i want. What i found is that there are some fixed style defined in the        enum MessageBoxStyle inside the class FUiCtrlMessageBox and all the examples are shown using those predefined message styles only. Please let me know if that is possible. I yes, how?
 
Thanks in advance...
 

 

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

11 Replies
Alex Dem
Hi 1) I thought right way was to add FocusEventListener for button pButton1->AddFocusEventListener(*this); inside of OnInitializing(). But OnFocusGained was not called after each button was pressed in this case. Try to set focus on pressed particular button forcibly. Focus of selected TextBox will lost. OnActionPerformed { ... Tizen::Ui::Controls::Button* pButton1=static_cast< Button* >(GetControl(IDC_BUTTON_1)); pButton1->SetFocus(); ... } 2)Try to use popups Tizen::Ui::Controls::Popup instead of MessgeBox. You could add as many as you want buttons in this case. Alexey.
Bikramjit Das
Hi Alex The suggestion you gave is helpful if you want to set focus for the button. But i want to remove the focus from the selected(highlighted/on focus) TextBox when the user clicks on a button. Thanks
Bikramjit Das
Hi Alex The suggestion you gave is helpful if you want to set focus for the button. But i want to remove the focus from the selected(highlighted/on focus) TextBox when the user clicks on a button. Thanks
wil smith
With FocusManager you can do it.
Siddharth Singh
Once the focus is shifted to Button the textboxes will automatically be out of Focus.
Alex Dem
Hi I did not find in Tizen API to reset focus. Proposed above way to set focus on pressed button is most simple. Visual changes will not be observed when you set focus on button. I suspect that buttons are not focusable elements, but they allow to use SetFocus() API and lose previous focus. I could propose another way, maybe it is more correct: 1)create invisible Textbox in OnInitializing pTextBoxLast= new TextBox(); pTextBoxLast->Construct(Rectangle(1, 1, 1, 1), TEXT_BOX_BORDER_NONE); AddControl(__pTextBox3); pTextBoxLast->SetShowState(false); 2)perform pTextBoxLast->SetFocus() on your button press. Alexey.
Siddharth Singh
One more point i would like to make......it seems you can not set focus on the same button which is clicked,though u can set the focus on some other Button. Please,correct me if i am wrong.
Bikramjit Das
Even i think likewise..because the button which is clicked already has the focus. but cant we remove the focus( if already set) in case of textboxes
Siddharth Singh
The focus has to be on some UI control at all time.So,we can only shift focus from one to another. That's why there is no way of removing focus and is there only for shifting focus such as setfocus() , setNextFocus() etc.
Bikramjit Das
But initially just after the app is launched, focus is not set anywhere. Cant we obtain that situation?
Siddharth Singh
Actually,in form based appications the Focus is on the Mainform at the start of the App. So,if that is what you want you can shift the focus to the form again as such : Frame *pFrame1 = UiApp::GetInstance()->GetAppFrame()->GetFrame(); pForm1 = pFrame1->GetCurrentForm(); pForm1 ->SetFocus();