PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

TEXT_INPUT CONTROL

Hello Everybody,
we are using edge for symbian uiq/s60.
Right now I need to have a normally functioning input text control. Original symbian CEikEdwin would be exactly what I need, can I use it somehow in edgelib app? Writing my own input control is way too much work - to handle caret, to handle all types of input, to handle selection copy/paste etc.
Basically it has to act like native control, otherwise it's a lot of trouble to make it work well.
How can I get native control drawn on the screen?
thank you!
Hi,

To get access to native UI's, you can get the window handle of the application, or the bitmap handle of the backbuffer. You can use the following code inside the framework:

Code:

//Get the window handle
RWindow *window = (RWindow *)GetWindowHandle();

//Get the surface bitmap
CFbsBitmap *bitmap = (CFbsBitmap *)display->buffer.GetSysApiSurface();
edge wrote:Hi,

To get access to native UI's, you can get the window handle of the application, or the bitmap handle of the backbuffer. You can use the following code inside the framework:
...



I assumed that it was all I needed to get native CEikEdwin shown, but I was wrong. I just tried to display it and I can't find a way to show it!!!

How do I use RWindow or CFbsBitmap to create a CEikEdwin?
Here's the code I used to create it:

Code:

RWindow *window = (RWindow*)m_pEdge->GetWindowHandle();

editor = new(ELeave) CEikEdwin();
CleanupStack::PushL(editor);

CCoeControl * cntrl = editor;
//editor->SetContainerWindowL(*window);
cntrl->SetContainerWindowL(*window);

editor->ConstructL(0, 15, 15, 1);
editor->SetObserver(observer_obj);
editor->SetExtent(TPoint(0,0),TSize(180,180));

editor->ActivateL();
CleanupStack::Pop();//editor



But the control would never show up.
So, I added this code inside OnNextFrame:
Code:
editor->DrawNow(rect);

And with this code I was able to see at least something... always blinking input control but it looked that my control couldn't ever get focus. So... can you please help me with this, how do I make it work properly.

In windows it would be no brainer, but I have no idea about how to get that done in symbian (I use uiq3 p1i for testing)

thanks
Hi,

Perhaps the following function can help:
CEikonEnv::Static()

This can be called from anywhere in your program and returns an CEikonEnv instance which derives from CCoeEnv. Please check your Symbian SDK for available functionality.
After spending MANY hours all I can say is that it's close to impossible for me to figure out how to do it without knowing internals of symbian or wihtout knowing internals of edgelib.

I tried to get all possible objects from the environment and checked all the functions from there and I can't find anything useful or working.

Is there anybody from edge developers who can advise on what action I need to take to be able to use native input box.

thanks
Hello Edgelib developers,
can anybody help me with that please?

I started similar thread on newlc.com and it seems that there's no way to get it done without extra help from edgelib itself (which has to provide certain callbacks/interfaces). Otherwise, using RWindow or CEikonEnv won't help at all!!! It's simple to do stuff like that in Windows using window handle, but it's impossible to do stuff like this in symbian!
Please help :)
Hi,

Can you tell me which interfaces, classes and callbacks you need? The more detailed information you can provide the more likely it is we can offer a solution.
Basically, I need to create a child control on existing window. I'm not a pro in symbian world, so I'm not sure what exactly I'd need to get it working (I tried many things that theoretically had to make it work, but on practice nothing worked, so I'm not sure what exactly would fix it)
I had discussion about that on newlc, maybe you can review it and give any ideas or comment on proposed solutions.
http://www.newlc.com/forum/native-symbian-input-control-and-3rd-paty-library

It all depends on how edgelib drawing and windowing stuff implemented. To create a child control on a window in UIQ3 I need to have access to parent CCoeControl and not RWindow itself; and that's the problem - there's simply no CCoeControl that I can get access to (or even there's none).
Also, from that discussion on newlc, it seems that in order to get it working properly and reliably edge has to work on top of Qik* classes and not on low-level Eik* classes
Hi,

I've followed the discussion. The good news is that EDGELIB indeed uses Qikon classes. It's also possible to receive events not implemented by EDGELIB through the OnNativeEvent callback of the framework.

However, the CCoeControl can't be expanded, because it is part of the EDGELIB internal Symbian framework. After reading the thread at newlc, it seems the best way to create your own CCoeControl and make it work together with EDGELIB. Because EDGELIB uses Direct Screen Access, drawing/ordering should be handled automatically.
Hi Edge,
I was away for a while and now I'm back in action :)
I tried some suggestion from ppl and I posted results that I observed to newlc thread. (take a look at my last post)
It seems with enough time spent on that I may get it working more or less appropriately, but it's all more like a hack, and it affects edgelib behavior, so I don't want to go this way. (I tried to put dialog like control on top of edgelib app)
About CCoeControl of internal edgelib symbian framework: I don't want and I don't need to extend that. All I need is to get access to it, so that I could pass it as a parent control that owns edwin. That's it.
Let's try this, if you give me binary offset where it's located in the ClassEdge instance, I'll brute cast offset to the ClassEdge obj and I'll get access to the CCoeControl and I'll try to add eikedwin to it and I'll let you know how it works.
Is it clear what I'm asking about? In windows I could enumerate all windows in the app and do what ever I want with any of it, but I have no idea how to enumerate windows (or ccoecontrols) in symbian, if it's possible at all.
I was able to get access to the CCoeControl created by edgelib, but only in UIQ3.

Here's how I do it:
Code:

CEikAppUi *eik_app_ui = CEikonEnv::Static()->EikAppUi();
CQikAppUi& app_ui = (CQikAppUi&)*eik_app_ui;
CCoeControl *current_control = app_ui.CurrentViewAsControl();


I did some other investigation, and it appears that it's the only view and the only control created by edge and it has no child controls. So, I used this current_control as parent for a edwin and it works partially. Now it can take input but it has problems with drawing: if I call DrawNow manually from withing OnNextFrame then it flickers, if I don't call manually DrawNow then control is invisible, but whenever it receives a char input it tries to update it's client area and I briefly see it till next OnNextFrame erases it again. So, I only need to find a way to make the edwin draw to the same surface used by edge, or make it draw to the screen after edge finishes blitting to the screen.

Also, I was unable to find a way how to access that parent CCoeControl in s60.
Ok, I found a way to get top CCoeControl portably between UIQ3 and S60:

Code:

CEikAppUi *eik_app_ui = CEikonEnv::Static()->EikAppUi();
CCoeControl *top_control = eik_app_ui->TopFocusedControl();
...
//then I add created edwin:
eik_app_ui->AddToStackL(editor);


I only need to solve drawing problem now!
Hi,

To fix the drawing issues you can suspend the display update from EDGELIB when the input control is active (it's odd that DirectScreenAccess doesn't handle this automatically).

To suspend drawing you can add the EFL_MANUALFLIP flag to the framework configuration. Call Flip() manually at the end of OnNextFrame, except when the control is visible.
Hi Edgelib, I have a couple of questions ...
can we use edgelib not as a framework, but as a library?
(to be able to do all our platforms specific stuff ourselves, and use some facilities provided by edge))
Currently it completely hides platform specific stuff and that's not what I want. Also, I use edgelib for symbian app developement because it better thatn to work with symbian directly, but because of constatnt redrawing it will affect battery and my app doesn't need constant redrawing.
Another question, it seems that I get memory leaks in E2DSurfaceRGBA. More specifically E2DSurfaceRGBA::gdata member. If I manually delete it then everything is fine, but I need to delete it like this:
delete[] (gdata - 4);
Is that the crazy way to use first 4 bytes as size of the block??
If you confirm that it leaks mem, can I get rebuild libs with the leak fixed?
thanks
Hi,

Currently it's only possible to use EDGELIB as a framework. The redrawing shouldn't be an issue, because you can configure the framework to only redraw when you want it to. In the OnFrameworkConfig callback, set the following flag:

Code:

config->flags = EFL_MANUALFLIP;


If you want to redraw, call display->Flip() at the end of OnNextFrame. The memory leak issue is odd and shouldn't happen (the gdata is freed in the destructor). Can you tell me how you create the surface, and is it stored globally?
I create it like this:
ecd.dsp->CreateSurface(&m;_pStates->m_BottomBar.m_PokerBtn,pData,nSize,EST_SYSMEMORY|EST_DITHER);

I tried to change parameters and stuff and it always leaked. Then I took latest code (3.80) and I still had the same problem.

So, I went samples and used helloworld for uiq3
I added member variable E2DSurfaceRGBA * m_Background; in ClassMain. Then I m_Background = new E2DSurfaceRGBA(); in constructor and delete in destructor: delete m_Background;
and
inside OnDisplayInit I do this: ecd.dsp->CreateSurface(m_Background, 240, 320, EST_SYSMEMORY|EST_DITHER);
And even in this simple test it leaks.
To fix that leak I did this:


Code:
class my_E2DSurfaceRGBA : public E2DSurfaceRGBA
{
public:
my_E2DSurfaceRGBA() : _gdata(*(char **)(((char*)(E2DSurfaceRGBA*)this) + 108)) {

}
~my_E2DSurfaceRGBA() {
Free();
if(_gdata){
delete[] (_gdata-4);
_gdata = 0;
}
}

char * &_gdata;
};

#define E2DSurfaceRGBA my_E2DSurfaceRGBA
Hi,

I've found the cause of the issue. The memory leak only happens when specifying extra flags, for example the EST_DITHER flag.

This is fixed and will be available in the EDGELIB 3.90 release. Thanks for the report.
Hi,
I tried to create a text box in order to use the on-screen keyboard on S60 5th edition devices.

I tried to do as suggested in an earlier post:

Code:
CEikAppUi *eik_app_ui = CEikonEnv::Static()->EikAppUi();
CCoeControl *top_control = eik_app_ui->TopFocusedControl();

RWindow *window = (RWindow*)m_pESSharedData->m_pEdge->GetWindowHandle();

iEdit1 = new(ELeave) CEikEdwin();
CleanupStack::PushL(iEdit1);

CCoeControl * cntrl = iEdit1;
//editor->SetContainerWindowL(*window);
cntrl->SetContainerWindowL(*window);

iEdit1->ConstructL(0, 15, 15, 1);
//iEdit1->SetObserver(observer_obj);
iEdit1->SetExtent(TPoint(0,0),TSize(180,180));

iEdit1->ActivateL();
CleanupStack::Pop();//editor

eik_app_ui->AddToStackL(iEdit1);



It works great on S60 3rd devices but on 5th edition, I cant see the created textbox and all the pointer events are sent to Edge and they are not received by the text box.

I tried to use dialog text box as follows:
Code:
CAknTextQueryDialog *dlg = new (ELeave)CAknTextQueryDialog( defaultText );
dlg->ExecuteLD(R_DIALOG_TEXT_EDIT_QUERY);


Now the dialog box is visible, but again, all the pointer events are sent to Edge and not to the open dialog box (I can't even press the "OK" or "Cancel" buttons).

Any idea what can I do?

Thanks,

Itamar
Hi Itaita,

For more help regarding your issue please refer to the following post: http://www.pocketmatrix.com/forums/view ... 308#286308