gtk+ : GtkFileChooserDialog hide some widgets - c

I have a little problem with the GtkFileChooserDialog.
I Want to hide the favoris panel (widget on the left).
So I start to get the GtkVBox of the GtkFileChooserDialog,
and now I Want to retrive it's child and hite it,
but I don't find it's children.
Here is my code :
my_dialog = gtk_file_chooser_dialog_new("Hop", NULL, GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL);
button = gtk_file_chooser_button_new_with_dialog(my_dialog);
children_dial = gtk_container_get_children(GTK_CONTAINER(my_dialog));
v_dial = GTK_VBOX(children_dial->data);
v_children = gtk_container_get_children(GTK_CONTAINER(v_dial));
So if anyone has an idea,
thanks.

The children of the GtkFileChooserDialog and GtkFileChooserWidget are "internal" children which means you can't retrieve them like that. You aren't supposed to mess with them, since they may be implemented differently in a future version. However, you can access them with gtk_container_forall().
Why do you want to hide the favorites panel? Unless you have a really good reason, it is bad user interface design to change the standard file dialog that users expect, just because you don't like the panel on the left.

Related

displaying multiple ascx in dotnetnuke

I am a newbie programming modules for dotnetnuke.
At this moment I use only the view.ascx for displaying my logic.
I need to display different views based on the login user and the attach user role. I can do it by setting some of the controls visible and non visible but I think it is not the right way and make the code unnecessary complex.
I came across an earlier question in stackoverflow (DNN: Using multiple web user controls in one module and showing different controls in different pages)
But have still some questions:
I have to add a new webformuser control in vs2013 when I want to design a new view in a seperate ascx?
I think the solution mentioned in the link using a placeholder will solve my question. But which steps do I need to transform my current solution with "view.ascx" to a solution with a placeholder?
I need to create first a new webusercontrol and named it "MasterControl.ascx" and put the placeholder control in it?
I need to create additionally for each view a new webusercontrol? What about the view.ascx? I dont need it anymore? What is the controlpath? Is it the path where the user control reside?
Is this the following layout:
MasterControl.ascx calling
userview1.ascx
userview2.ascx
...
userviewk.ascx
How to register "MasterControl.ascx"? I dont see "add control" in my current module when edited? I used DNN 7.2.x with the Cristoc addin.
I have to replace child1 wirh userview1 etc? When I supply the condition the corresponding userview.ascx will be displayed?
I a am a complete newbie so I need a step by step "cookbook recipe" how to convert my current module with, only using, a one "view.ascx" approach with a more flexible multiple ascx solution.
Thanks in advance,
Regards,
Henk
a copy of the code mentioned in the above link.
string childControl;
switch (condition)
{
case "condition1":
childControl = ControlPath + Child1.ascx";
break;
case "condition2":
childControl = ControlPath + Child2.ascx";
break;
...more conditions...
}
PortalModuleBase objModule = (PortalModuleBase)this.LoadControl(childControl);
if ((objModule != null))
{
myPholder.Controls.Clear();
objModule.ModuleConfiguration = this.ModuleConfiguration;
myPholder.Controls.Add(objModule);
}
If you only have a few things to hide or show then you could make use of <asp:Panels>. You could the set the visibility depending on a calculated property or some other logic; for instance, I have used the IsSuperUser property.
ASCX file:
<asp:Panel id="pnlSomeDeclarativeCode" runat=server>
<h1>Hide or show me</h1>
</asp:Panel>
In your codebehind file:
private Initialise()
{
pnlSomeDeclarativeCode.Visabilty = UserInfo.IsSuperUser;
}

Drupal 7 alter node display

I have a content type with two image fields, banner and logo.
I am trying to implement logic which will allow one of the two to display depending on whether an editor elected to display just the banner or just the logo from radio button options.
I setup a small custom module implementing hook_node_view and tried to unset the image field from the node object but no joy. Code fragment below:
function mymodule_node_view($node, $view_mode, $langcode){
unset($node->field_main_picture[$node->language][0]);
unset($node->field_main_picture);
$node->field_main_picture = null;
}
None of those attempts worked.
I found the answer to my question.
The node object contains an array called content which is the renderable data Drupal will print to screen.
It's in that array that my unsets need to take place. I.E:
unset($node->content['field_main_picture']);
And the main picture image disappears.
I hardly suggest you to work with Devel module when you are programming like that. It allows you to display variables in your page and visualize the tree. For example, you can call dpm($node) function in your hook_node_view() to see what's in $node and how to access it.

Implementing basic next/previous picture

I'm trying to convert the Adjuster example mentioned here: http://agiletoolkit.org/learn/understand/view/interactive
into a View that is able to show me the next/previous picture of a list of given images.
I guess the number in the example could be an index into an array of pictures.
I'm just not sure how to provide the list of pictures, when all the code is put in init() for the View, so no way to give it the picturelist before that...
Should I use memorize/recall for this list also to prevent it getting lost upon reload ?
is there another example that might help me?
I think you what you are doing can be much easier done with a classic JavaScript Lightbox script. You would supply it list of images and it would show one full-screen.
If not, you can use this:
https://gist.github.com/romaninsh/7217119
This will give you slides similar to the ones on http://agiletech.ie/
Be advised that this code is a little old.

How to add a custom field into template.php using Zen sub theme

First time poster here, I'm a designer not skilled at all with php and I have a small issue I don't seem to be able to solve. I'm making a site in drupal 7 using a sub theme on zen.
Btw this is a great CMS, even though people say it's really more a developers CMS. I have no trouble to do what I need using views, rules, display suite etc. So a big thank you for all the developers out there making this such a good CMS. But for this apparently simple problem... no module will help me (I think) and I'm kinda stuck.
So here it is: I'd like to add a subtitle next to the title in all my pages.
So what I did was to add a custom field into the content type basic page (machine name: field_sub_title) which is a simple text field.
I uncommented the following line in my template.php
function mytheme_preprocess_page(&$variables, $hook) {
$variables['sub_title'] = t('field_sub_title');
}
Now my question is how do I load the content of my custom field into that variable?
I know i need to change the second part, but I don't have a clue as into what I need to change this.
Displaying the variable into the the page.tpl.php is something I know about so I only need help with the first part.
{EDIT}
Ok I found how to do this :)
I was looking for a solution in the wrong place. I don't need to change any thing in the template.php file.
Just needed to add this bit of code into my page.tpl.php:
<?php
print $node->field_sub_title['und'][0]['value'];
?>
So I'm posting this here for other Drupal newbies struggling with this....
Your solution may work for now, but there may be a more Drupal-y way to handle a problem like this. If you haven't noticed any problems yet, you may find one or more of the following issues down the road:
Someone who doesn't know php or Drupal theming may need to change the way this works.
If you're like me, you may forget where exactly in code this was implemented.
You may see superfluous markup and/or errors on nodes (content) that do not have this sub-title field (ie. event content not having a sub-title field while basic pages and news articles do).
When you add a field to a content type, it will automatically appear anytime content in that content type is displayed. You should be able to add the sub-title field for your page, event or whatever else you need and have it automatically appear in the markup.
You can 'manage display' of a content type to drag and drop the order for fields to appear. You could take it a step further by using a module like Display Suite to add formatting or layout per-content type.
If you feel like this isn't good enough and the markup for the subtitle must be at the same level as the page title (which is rare), at least add an if statement to make your code check to see if the variable is present before trying to print it. I'd also add a new variable and comments for code readability.
<?php
$subtitle = $node->field_sub_title['und'][0]['value'];
if($subtitle){
print $subtitle;
}
?>
Consider using field_get_items or field_view_value, or at least use the LANGUAGE_NONE constant instead of 'und'
See https://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7 and https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_value/7
This has the added benefit of reducing the number of potential security holes you create.

Dynamic Hyperlink in Livecycle Form

I am trying to figure out how to make a hyperlink in a Livecycle Form which points to a URL which will change on different days that the form is rendered. For example on one day I might want the hyperlink to point to:
mywebsite/mypage?option=XXX
and on another day I want it to point to:
mywebsite/mypage?option=YYY
The XXX and YYY can be passed into the form's data pretty easily as XML, but I just don't know how to make it so that the hyperlink is changed to correspond to this.
Any suggestions?
This can be accomplished with JavaScript in LiveCycle Designer. The following script, placed on the Form's docReady event will let you dynamically change the URL of a text object.
form1::docReady - (JavaScript, client)
// If this code is running on the server, you don't want it to run any code
// that might force a relayout, or you could get stuck in an infinite loop
if (xfa.host.name != "XFAPresentationAgent") {
// You would load the URL that you want into this variable, based on
// whatever XML data is being passed into your form
var sURL = "www.stackoverflow.com"; // mywebsite/mypage?option=xxx
// URLs are encoded in XHTML. In order to change the URL, you need
// to create the right XHTML string and push it into the Text object's
// <value> node. This is a super simple XHTML shell for this purpose.
// You could add all sorts of markup to make your hyperlink look pretty
var sRichText = "<body><p>Foo</p></body>";
// Assuming you have a text object called "Text1" on the form, this
// call will push the rich text into the node. Note that this call
// will force a re-layout of the form
this.resolveNode("Text1").value.exData.loadXML(sRichText, false, true);
}
There are a couple of caveats: URLs in Acrobat are only supported in Acrobat 9.0 and later. So if someone using an older version of Acrobat opens your form, the URLs won't work.
Also, as you can see from the "if (xfa.host.name !=...)" line, this code won't run properly if the form is being generated on the server, because forcing a re-layout of a form during docReady can cause problems on certain older versions of the LiveCycle server. If you do need to run this script on the server, you should probably pick a different event then form::docReady.
I a number of complaints from users in WorkSpace that clicking links opened them in the same tab so they lost their WorkSpace form, and there's no option to change that in Designer 11. I think the solution I came up with for that would work for you too.
I made buttons with no border and no background, and in their click event have this line (in Javascript, run at client)
app.launchURL("http:/stackoverflow.com/", true);
It would be easy to add some logic to choose the right URL based on the day and it doesn't cause any form re-rendering.
In some spots where the hyperlink is in line with other text, I leave the text of the link blue and underlined but with no hyperlink, and just place the button (no background, no border, no caption) over it. Does require positioned and not flowed subforms for that to work, so depending on your layout it could get a little clunky.
Wow, just realized I am super late to the party. Well, for anyone using ES4 facing a similar problem . . .
Ended up using a 3rd party component to manipulate the PDF's hyperlinks...wish there was a better solution as this one costs about $1000.

Resources