What i'm trying to achieve is that when a popup is displayed, the input panel (keyboard) appears as well, and when the user start typing it also update the entry content that is on the panel content.
Unfortunately this appear to be quite complex in Tizen.
What I obtained so far is that the popup is displayed, the kepad too, but when I press buttons on the keypad they are not updating the entry.
In order to start real typing even if the keypad is displayed, i have to tap on the entry.
I did many different tries, without success. The following is the first version of the code and i try to list all the changes i tested:
Evas_Object *popup, *layout;
popup = elm_popup_add(parent);
elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_part_text_set(popup, "title,text", "Use energy");
layout = elm_layout_add(popup);
elm_layout_theme_set(layout, "layout", "drawer", "panel");
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(popup, layout);
Evas_Object *entry = elm_entry_add(layout);
set_number_on_entry(entry, 0);
elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
elm_entry_input_panel_show(entry);
elm_object_part_content_set(layout, "elm.swallow.content" , entry);
dlog_print(DLOG_INFO, APP_TAG, elm_entry_entry_get(entry));
container->entry = entry;
Evas_Object *button1;
button1 = elm_button_add(popup);
elm_object_text_set(button1, "OK");
elm_object_part_content_set(popup, "button1", button1);
elm_object_style_set(button1, "popup");
evas_object_smart_callback_add(button1, "clicked", ok_pressed_energy, container);
/* Add a "Cancel" button to popup */
button1 = elm_button_add(popup);
elm_object_text_set(button1, "Cancel");
elm_object_part_content_set(popup, "button2", button1);
evas_object_smart_callback_add(button1, "clicked", dismissed_cb, popup);
evas_object_smart_callback_add(popup, "dismissed", dismissed_cb, NULL);
container->popup = popup;
evas_object_show(popup);
elm_object_focus_set(entry, EINA_TRUE);
elm_entry_cursor_end_set(entry);
The first version of the code (the one above) was trying to display the panel while the popup was still creating. So maybe the show call could have impacted on the focus status for the entry.
The following are the changes i tried in order:
I tried to explicitly allow the focus on the entry using:
elm_object_focus_allow_set(entry, EINA_TRUE);
without luck. I also tried to explicitly give the focus to the entry just after the focus allow was set to true, again no success.
I tried to show the panel after the entry was focused (then after the show function for popup was called. Again not working.
Added:
elm_entry_input_panel_enabled_set(entry, EINA_TRUE);
The documentation for that function says:
If true, the input panel is appeared when entry is clicked or has a focus.
Not working
Tried to display the code using the context obtained from the entry with the following code:
Ecore_IMF_Context *imf_context = (Ecore_IMF_Context*)
elm_entry_imf_context_get(entry);
if(imf_context){
dlog_print(DLOG_INFO, APP_TAG , "Imf context");
ecore_imf_context_input_panel_show(imf_context);
}
I tried to post the question also on the Tizen foru, but i still didn't get an answer that solve my problem, this is the link: https://developer.tizen.org/forums/native-application-development/entry-on-popup-focus#comment-27748
What i'm doing wrong? I tried everything but at the moment with no luck. And unfortunately the documentation is not covering this use case (that i think is quite common).
Any help?
Related
I have a Tizen Edje file which defines my layout. One part is an image with part name 'warning'. The item is set to visible in the edge file, and it shows as expected.
I want to hide this part using C code:
Evas_Object* image_NotSetYet = (Evas_Object *) edje_object_part_object_get(elm_layout_edje_get(wid->edjeLayout), "warning");
if (image_NotSetYet == NULL) {
dlog_print(DLOG_ERROR, LOG_TAG, "View: Unable to get warning image part");
return;
}
evas_object_hide(image_NotSetYet);
I have tried many different ways to get the Evas Object associated with this part name and hide it. After many hours I stumbled onto some code that I modeled after, and it seems to work. I can hide (and show) my image part now.
However, I later add an unrealted image to a swallow in this layout and show it. All of a suddent the 'warning' part image shows again. Why? Am I hiding the 'warning' part the wrong way? Is there something wrong with the above?
Alternatively, is there something wrong with the way I am adding an image to the swallow below? The image (from file) will show up, but suddenly my warning part above shows too:
Evas_Object *img = elm_image_add(wid->edjeLayout);
if (img == NULL) {
dlog_print(DLOG_ERROR, LOG_TAG, "View: Failed to add a image.");
return;
}
// Create an image and set contents to imagefile
char *imageFileName = barcode_filename();
bool isSet = elm_image_file_set(img, imageFileName, NULL);
dlog_print((isSet?DLOG_INFO:DLOG_ERROR), LOG_TAG, "View: %s file [%s] to image",(isSet==EINA_TRUE?"Set":"Failed to set"),imageFileName);
free(imageFileName);
evas_object_show(img);
// Assign the image to the swallow2 part
elm_object_part_content_set(wid->edjeLayout,"swallow2",img);
I tried adding the image to the 'window' instead of the 'layout' but that didn't seem to matter. (I've seen many contradictory examples so I don't know which is right)
I tried setting the image to the 'swallow2' part name many different ways (again, many contradictory ways show). Is this the problem?
Otherwise, can someone explain what is going wrong?
The image_NotSetYet is not an image object.
Evas_Object* image_NotSetYet = (Evas_Object *) edje_object_part_object_get(elm_layout_edje_get(wid->edjeLayout), "warning");
That refers to the "warning" swallow part object.
You should never modify the state of the returned object, because it's meant to be managed by Edje, solely.
If you want to get the image pointer from your layout as you expected, you could use following instead.
Evas_Object* image_NotSetYet = elm_object_part_content_get((wid->edjeLayout), "warning")
But as above link describes, the image object should be manged by Edje.
You might got the 2nd problem because it is managed by Edje. So please use edje_object_signal_emit to handle swallowed images.
First time Posting on this site. I hope I have the information formatted correctly.
I am designing a simple windows form to help create change control forms to track employee access. It is a 2 part form. The main form asks for some user input and there is a checkbox at the bottom that they can select if they are requesting a standard user setup. When they click next in the main form a child form window pops up that contains a treeview and a comments section for any special notes. What I am trying to do is have some nodes automatically checked if the 'Standard Setup' box is checked in the main form.
When I run the code I get a error stating "Method invocation failed because First[System.Windows.Forms.TreeView] does not contain a method named 'checknode'."
My standard setup box is $checkboxStandardSetup and if it has been checked then I want to have it place a checkbox next to these nodes in the treeview. If it isn't checked no other modification need to be made in the treeview. Here is a snippet of what I have.
if ($checkboxStandardSetup.Checked)
{
$treeview1.checknode("7")
$treeview1.checknode("8")
$treeview1.checknode("9")
$treeview1.checknode("10")
$treeview1.checknode("11")
$treeview1.checknode("12")
$treeview1.checknode("14")
$treeview1.checknode("20")
}
I have also tried to use
if ($checkboxStandardSetup.Checked)
{
$treeview1.node7.checked
$treeview1.node8.checked
$treeview1.node9.checked
$treeview1.node10.checked
$treeview1.node11.checked
$treeview1.node12.checked
$treeview1.node14.checked
$treeview1.node20.checked
}
But to no avail. The function below works to parse through and then output a list of the checked nodes but I can't get the standard setup box to apply those checks.
Function Get-CheckedNodes
{
param (
[ValidateNotNull()]
[System.Windows.Forms.TreeNodeCollection]$NodeCollection,
[ValidateNotNull()]
[System.Collections.ArrayList]$CheckedNodes)
foreach ($Node in $NodeCollection)
{
if ($Node.Checked)
{
[void]$CheckedNodes.Add($Node)
}
Get-CheckedNodes $Node.Nodes $CheckedNodes
}
}
To call the function I use
$checkedNodes = New-Object System.Collections.ArrayList
Get-CheckedNodes $treeview1.Nodes $CheckedNodes
foreach ($node in $CheckedNodes)
{
Write-Output $node.text | Out-File -append C:\Change\UserForm$(Get-Date -Format 'MM-dd-yy').csv
}
I expected the treeview list to have a checkbox next to the nodes that I coded but instead I get the above error. I don't understand what I am doing wrong. Any advice appreciated!
I created a tree view controls using WinApi. I want to capture mouse click on checkboxes. The notification message NM_CLICK contains NMHDR, which has no information about the node being clicked. since the clicked node may be different from the selected node, there should be a way to find which node has been checked or unchecked, It could be HTREEITEM, or lParam Inserted when adding items to tree view. I want to capture the checking/unchecking in real time. How can I specify which Node being checked/unchecked? any help or link appreciated.
mr.abzadeh
I want to capture the checking/unchecking in real time. How can I
specify which Node being checked/unchecked?
for this exist notification TVN_ITEMCHANGING and TVN_ITEMCHANGED - look for uStateNew and uStateOld members of NMTVITEMCHANGE - when tree view have checkboxes (TVS_CHECKBOXES style) it used as state image list with 2 images - unchecked and checked.
so state & TVIS_STATEIMAGEMASK will be 0 when no checkbox, INDEXTOSTATEIMAGEMASK(1) for unchecked and INDEXTOSTATEIMAGEMASK(2) for checked. based on this info we can and capture mouse click on checkboxes
by using TVN_ITEMCHANGING you can also prevent the change when you return TRUE for this notification. if you need only notify - use TVN_ITEMCHANGED
case WM_NOTIFY:
{
union {
LPARAM lp;
NMTVITEMCHANGE *pnm;
NMHDR* phdr;
};
lp = lParam;
switch (phdr->code)
{
case TVN_ITEMCHANGING:
{
UINT CheckStateOld = pnm->uStateOld & TVIS_STATEIMAGEMASK;
UINT CheckStateNew = pnm->uStateNew & TVIS_STATEIMAGEMASK;
if (CheckStateNew != CheckStateOld)
{
PCSTR szstate = "??";
switch (CheckStateNew)
{
case INDEXTOSTATEIMAGEMASK(1):
szstate = "uncheck";
break;
case INDEXTOSTATEIMAGEMASK(2):
szstate = "check";
break;
}
DbgPrint("%p>%s\n", pnm->lParam, szstate);
}
}
return FALSE;
}
}
also read How to Work With State Image Indexes
// Image 1 in the tree-view check box image list is the unchecked box.
// Image 2 is the checked box.
tvItem.state = INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1));
notification TVN_ITEMCHANGING and TVN_ITEMCHANGED is available begin from Windows Vista. if you need XP support too - on xp only option use #IInspectable solution
You can send a TVM_HITTEST message (or use the TreeView_HitTest macro) to find the tree view item, given a client-relative coordinate.
To get the cursor position at the time the NM_CLICK message was generated, use the GetMessagePos API.
This allows you do monitor any mouse click in the client area of the control. If you are interested in the state changes as the result of the standard tree view control implementation, you can handle the TVN_ITEMCHANGING or TVN_ITEMCHANGED notifications instead. Both supply an NMTVITEMCHANGE structure, where the hItem identifies the item being changed, and lParam carries application specific data.
I'm attempting to add an about dialog to my next bit of tutorial code, but I can't get the icon to load for some reason. Below is the entire function for creating and displaying the dialog.
static void help_clicked(GtkButton *button, GtkWindow *window)
{
const gchar *authors[] = { "me", NULL };
const gchar *license = "somestuff";
GdkPixbuf *logo = gdk_pixbuf_new_from_file("logo.png", NULL);
gtk_show_about_dialog(window,
"authors", authors, "license", license, "license-type", GTK_LICENSE_CUSTOM,
"logo", logo, "logo-icon-name", "Logo Icon",
"program-name", "Chapter 6, Exercise 1",
"version", "1.0",
"comments", "This is just an exercise from Chapter 6 of the book I'm reading.",
"website", "http://www.google.com", "website-label", "Application Homepage",
"copyright", "(C) 2014 Patrick Meyer",
"wrap-license", TRUE, NULL);
}
This results in an about dialog with every attribute successfully set except the icon.
The weird thing is, the exact same call to gdk_pixbuf_new_from_file() works in main() when I supply it to gtk_window_set_icon(). This is a single-file program with logo.png present in the directory of execution. What's missing?
as the API reference clearly states, the GtkAboutDialog:logo-icon-name property overrides the GtkAboutDialog:logo property:
https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html#GtkAboutDialog--logo-icon-name
also, you're passing a value for the logo-icon-name property that does not mean anything; the logo-icon-name property requires a named icon according to the Icon Naming Specification.
just remove the logo-icon-name property and you'll see the correct icon.
as a side note from your example: you should release the reference on the GdkPixbuf object you create after gtk_show_about_dialog() returns, otherwise you will leak it. ideally, though, since you don't want to load the image file from disk every time you click the help button, you should use something like this:
static GdkPixbuf *logo_icon = NULL;
if (logo_icon == NULL)
logo_icon = gdk_pixbuf_new_from_file ("logo.png", NULL);
gtk_show_about_dialog (...);
which will keep the pixbuf around for the duration of your application.
another option is to use GResource and inject the image data into the application's binary.
The problem is you are setting logo-icon-name too which is supposed to be a symbolic name for an icon, not a human description.
So the internal image is being set correctly and then replaced internally a second time. This also explains why calling gtk_window_set_icon() afterwards works correctly.
The problem is with the logo-icon-name property. As it is stated inside the documentation, this overwrites the logo property. If you leave out the logo-icon-name property, the logo will show correctly.
I'm using gtk3 in Anjuta with C, with the following cut-out version of my code:
u.wMenuButton = gtk_menu_button_new();
u.weaponMenu = gtk_menu_new();
u.weaponCI = gtk_menu_item_new();
u.weapon = gtk_button_new_with_label("Punch");
gtk_box_pack_start(GTK_BOX(u.horizontal), u.wMenuButton, TRUE, TRUE, 1);
gtk_menu_button_set_popup (GTK_MENU_BUTTON(u.wMenuButton), u.weaponMenu);
gtk_container_add (GTK_CONTAINER(u.weaponCI), u.weapon);
gtk_menu_attach(GTK_MENU(u.weaponMenu), u.weaponCI, 0, 1, 0, 1);
The only difference in my real code is that I used an array of "weaponCI" and "weapon" and formatted each one identical to the above. I've tried NOT using an array, but it didn't work. I've tried different menu_attach column and row combinations, and nothing worked. I've tried using menubars as indicated in tutorials, and it didn't make a difference. I've reviewed the documentation and some tutorials, and I can't figure out what I have wrong.
I've almost completely sure that my headers and everything is fine, and nothing but the menu is working wrong.
However, the menu still pops up as a tiny flat rectangle with nothing in it at the corner of the screen.
Well, did you try to call gtk_widget_show_all on it ?