w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using a UIButton subclass on the storyboard makes the button's border vanish
The cause of this, as discussed in Subclasses of UIButton loaded from nibs are not initialized properly, is that the 'types' for a UIButton that you can select from the storyboard are actually implemented as UIButton subclasses. UIButtons have no border by default; the border comes from the 'System' or 'Rounded Rect' type. The docs for the code-based equivalent of selecting a type in interface builder hint at this, and at the fact that these 'types' are thus incompatible with custom subclasses: buttonWithType: ... This method is a convenience constructor for creating button objects with specific configurations. If you subclass UIButton, this method does not return an instance of your subclass. When setting both a 'type' and a custom class in Interface Builder, iOS will ign

Categories : IOS

No resizing, but positioning when setting backgroundImage of UIButton
Try this: You can have a UIImage after some CGRect inside any UIViews. Just make a CGRect with the part of the UIImageView that contains your original UIImage, and execute the code below: CGRect newImageFrame = CGRectMake(...); //fill this rect according to the crop area of the imageView UIGraphicsBeginImageContextWithOptions(newImageFrame, YES, 0); [editingCell.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); Now the newImage will hold the image that you will use as background of your button. Example: Assuming your UIImageView has the frame (50,50, 100, 200), you can crop a similar result of your image with something like this: newImageFrame = CGRectMake(50, 130, 100, 40). Please

Categories : IOS

iOS UIButton disappears after setting background image to nil
Instead of changing the background image of the button in the UIControlStateNormal, why not instead just change states of the button? If you created the button programmatically, you just need to add the line [btn setBackgroundImage:[UIImage imageNamed:@"check.png"] forState:UIControlStateSelected]; Then, when pressed and you want it to be the arrow image: [btn setSelected:YES]; and to set it back to the default appearance: [btn setSelected:NO]; If you made the button in a XIB, you can set the state images by changing the state config to Selected and set the image there.

Categories : IOS

Setting UIImage to highlighted when another UIButton is pressed
UIImage does not have a highlighted state (check the documentation: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImage_Class/Reference/Reference.html)

Categories : Iphone

How to make viewWillAppear to be called when we use a subclass of UITableViewController to handle table delegate?
Make the table view controller a child view controller of your view controller while its view is linked (and it is the data source) and could be on screen. This tells the view controller hierarchy that the table view needs to know about the appearance callbacks.

Categories : Objective C

setting a value to the second handle in jquery slider ui
Forgot the API instructions all together and worked it out myself, this changes the value of a handle. $("#slider-range").slider('values',1,x); where 1 is the handle index and x is the vale you want to set it to

Categories : Javascript

UIButton Highlighted State not showing when clicking over a Selected UIButton
The various states: UIControlStateNormal, UIControlStateSelected, and (UIControlStateSelected | UIControlStateHighlighted) are all actually distinct. If you want your shadowImage to apply both in the (only) highlighted state and in the highlighted+selected state, you must also set: [button setBackgroundImage:shadowImage forState:(UIControlStateHighlighted | UIControlStateSelected)]

Categories : IOS

UIButton added to UIButton not responding to selector
Your btnOnPopup is out of detailBtn's bounds so touches won't even get to it. Adding a button to a button is not really a great practice anyway. Adding it to a button's superview might be a little bit better (and will make your touches work, but you might need to adjust frame) [detailBtn.superview insertSubview:btnOnPopup aboveSubview:detailBtn];

Categories : IOS

Setting Caliburn IWindowmanager's Owner Property to Excel with handle HWND
It looks like you are hosting a WPF application (add-in) inside Excel which is an Office application and Caliburn.Micro has a constructor in BootstrapperBase class exactly for this situation, it looks like this: BootstrapperBase(useApplication = true), so you should derive your bootstrapper from BootstrapperBase and pass in false to the base constructor. something like this: class MyBootstrapper : BootstrapperBase { MyBootstrapper() : base(false) { } } Then Caliburn.Micro will set the owner property correctly for you, you don't have to worry about it. Now if you knew about this but it didn't work for then comment on this and i will give you a solution specific to your situation. Edit: To set the owner of the created window we need to set the Owner property (which

Categories : Excel

How can ‘protected static’ variable of superclass be accessed in the subclass, where subclass resides in different package..?
From "Checking Access to Protected Members in the Java Virtual Machine": Let m be a member declared in a class c that belongs to a package p. If m is public, it can be accessed by (code in) any class. If m is private, it can be accessed only by c. If m has default access, it can be accessed only by any class that belongs to p. If m is protected, things are slightly more complicated. First, m can be accessed by any class belonging to p, as if it had default access. In addition, it can be accessed by any subclass s of c that belongs to a package different from p, with the following restriction: if m is not static, then the class o of the object whose member is being accessed must be s or a subclass of s, written o ≤ s (if m is static, the restriction does not apply: m can be alw

Categories : Java

How to change subclass referenced by parent class to have a reference type of subclass?
Is there any way to change the type of eventDto in ProcessMessage() from EventDto to its actual derived type (say, of EventDtoSubclass2)? No. You either know the type ahead of time (and can either cast it or use it as a generic type parameter or whatever) or you have to detect it after the fact and branch on it. Since it appears you don't know ahead of time what you're getting, then you need to detect it and branch on it (and by that I mean using is/as or GetType/typeof or whatever your favorite method of checking is). As somewhat of an alternative, if you can change your EventDto-derived classes, you could potentially add a virtual Process function to the base class with overriden versions in each derived class that do the right thing. That depends on what Process actually does, tho

Categories : C#

Subclass of custom class that needs to subclass NSManagedObject
Try to use a protocol to specify what is common between the classes and allow the 'using' code to be generic to the protocol. The specification of a protocol is the important part, the implementation already exists in the 2 classes you have. The specification would list the common methods (or properties) between the 2 classes. Then, in the duplicated code, instead of saying: InventoryItem *item = ... or FavoriteInventoryItem *item = ... You would say: id < InventoryItem > item = ... I'm duplicating names because I can't know what a better name is, but the protocol is defined as: @protocol InventoryItem < NSObject > @property (nonatomic, strong) NSString * desc; @property (nonatomic, strong) NSString * locationInventoryId; @end Then the code using the protocol do

Categories : IOS

Adding a virtual function to a sub-subclass without it being in the subclass?
You could always define f() in class C2 as such: class C2 : public C1 { virtual void f() { C1::f(); } }; Which would allow C2 to function as if C3 never existed.

Categories : C++

How to call a subclass from other subclass which are under a outer class
As usual in order to call a non-static method, you need an instance to invoke it on. Either make the methods static or create instances of the classes. Here is one option on how to get your code working: import java.util.*; import java.lang.*; class main{ static void method2(){ System.out.println("This is outer class method"); } static class M2{ static void method1(){ System.out.println("This is method1 in class m2"); method2(); } } public static void main(String[] args){ M2.method1(); //test a=new test(); //a.method2(); } }

Categories : Java

Use a UIViewController's Subclass property as IBOutlet in another Subclass
Just "redeclare" the @property in your subclass. #import <UIKit/UIKit.h> #import "MySuperClass.h" @interface MySubClass : MySuperClass @property (nonatomic, strong) IBOutlet UITableView *tableView; @end The compiler will be clever enough to understand your are referencing the super class property, and IB will have no problem linking to the subclass's one.

Categories : IOS

Use pre-iOS 7 look and feel on iOS 7
If you're using the standard UI components you're going to automatically get the new style on iOS 7, there's no way I've come across to force them to appear as they would in iOS 6. The only way you're going to be able to have them appear as iOS 6 elements is to build custom elements and style them yourself, however there's a risk in doing that that when you submit to Apple they'll reject on the basis of breaking the HIG.

Categories : IOS

Look and feel setup for different OS
Perhaps your answer is available here: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html Or read into this SO question: How to set jframe look and feel

Categories : Java

PHP if statements - I feel like an idiot
Um, you have checked="checked" outside your if anyway. Remove those: <input type="radio" id="flag" name="flag" value="0" <?php if($row['flag_active'] === 0){ echo 'checked="checked"';} ?> /><label for="flag">Inactive</label> <input type="radio" id="flag1" name="flag" value="1" <?php if($row['flag_active'] === 1){ echo 'checked="checked"';} ?> /><label for="flag1">Active</label>

Categories : PHP

JTable Row Header Look And Feel
To keep the System LookAndFeel you need to change your renderer a little bit. First extends your renderer with UIRessource. You need this marker interface to receive UI changes: class HeaderRenderer extends DefaultTableCellHeaderRenderer implements javax.swing.plaf.UIResource { Then get and hold the original renderer from your JTableHeader (e.g. as field defRenderer passed by a constructor). In your getTableCellRendererComponent call the defRenderer.getTableCellRendererComponent, modify and return this JLabel. private final TableCellRenderer defRenderer; HeaderRenderer (TableCellRenderer defRenderer) { this.defRenderer = defRenderer; } @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boo

Categories : Java

Message boxes with Windows 7 look-and-feel
The kind of customization you are looking for can be achieved by using TaskDialog() or TaskDialogIndirect(), instead of MessageBox(). They are the preferred message box functions on Vista and later versions of Windows, because they are more flexible and they make more use of standardized Windows UI elements for a more consistent look with other UIs. For example: TaskDialog(hMyWnd, hInstance, L"Music", L"You have the latest version of Music", NULL, TDCBF_OK_BUTTON, MAKEINTRESOURCE(MY_MUSIC_ICON_ID), NULL); int iBtn = IDNO; if (TaskDialog(hMyWnd, NULL, L"Music", L"Do you really want to quit?", NULL, TDCBF_YES_BUTTON | TDCBF_NO_BUTTON, NULL, &iBtn) == S_OK) { switch (iBtn) { case IDYES: initdw(); break; case IDNO: adw();

Categories : C++

want to implement jtattoo look and feel, but not working
You don't have to loop and setting n-times in your code. Just in your Main Project main() put this line. UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");

Categories : Java

Changing look and feel of specific window
The problem originates from attempting to do the PLAF change in a static block. Move it to the constructor and it works. import java.awt.Dimension; import java.awt.GridBagLayout; import javax.swing.*; import javax.swing.UIManager.LookAndFeelInfo; public class GUI extends JFrame { private static LookAndFeel originalLookAndFeel = UIManager.getLookAndFeel(); private GridBagLayout gridBag = new GridBagLayout(); private JTabbedPane tabs = new JTabbedPane(); private JPanel selectionPanel = new JPanel(gridBag); private JPanel infoPanel = new JPanel(gridBag); private JPanel settingsPanel = new JPanel(gridBag); public GUI() { System.out.println("At start, look and feel is " + UIManager.getLookAndFeel().getName()); try { setNimbusLookAndFee

Categories : Java

jxdatepicker with Synthetica Aluoxide look and feel not working
I have had this exception as well, but it some years back already. I remember it because it seems that Synthentica is enforcing the use of its SwingX extention when you only have a license for Synthetica core, and I was "not amused" by that. Turns out that this is not the case (because I'm using Synthetica core + SwingX now), but my memory fails me in how I got rid of that exception. Searchinf through the source code does not help either, so maybe an emailto Jyloo is in order.

Categories : Java

How do you determine the look and feel of Qt Creator when compiling from source?
https://wiki.archlinux.org/index.php/Uniform_Look_for_Qt_and_GTK_Applications It looks like there is a config tool for helping with this: Qt4 styles cand be changed in a similar way: Using the KDE4 System Settings (systemsettings), the settings can be found in Common Appearance and Behavior > Application Appearance > Style > Widget Style Using the command-line tool $ kwriteconfig --file kdeglobals --group General --key widgetStyle [name of style]. Using the Qt Configuration (qtconfig-qt4) application, the settings can be found in Appearance > Select GUI Style. Hope that helps.

Categories : Qt

New to Prepared Statements, just doesn't feel secure
To answer your questions YES the variables in the // Set Variables section are secure, or more technically the variables will become secure before the query is executed. Mysqli takes care of it for you.

Categories : PHP

Conceptual difference between git fetch and git merge? Why do they feel same to me?
git fetch is to get the changes without merging, giving you control. Git pull does a fetch and merge. get fetch doesnt change your working data. git merge does. You can see the code changes before they happen with a git fetch

Categories : GIT

Change the look and feel of java application on runtime (IDE: Netbeans)
You can do that by calling SwingUtilities.updateTreeComponentUI(frame) and passing container component. Be aware that it won't be efficient always. So something like this: public static void changeLaf(JFrame frame) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } SwingUtilities.updateComponentTreeUI(frame); } This method changes current LaF to systems. EDIT: Changing LaF via JRadioMenuItem demo: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import java

Categories : Java

Any way to change look-n-feel for query windows? Just jacked up production
Open up SQL Server Management Studio On the View menu make sure that Registered Servers is visible (alternatively hit CTRL+ALT+G In the Registered Server panel expand Database Engine Right-click Local Server Groups Chose New Server Registration Fill in your necessary server details and then switch to the Connection Properties tab Click on the Use custom color checkbox Select the colour to be used. I tend to chose bright-red for live servers and green for development environments. Save your Registered Server. Next time you open a query on this connection the status bar at the footer should show the colour you selected. IMPORTANT: If you change the connection of a query window (option in the right-click context menu) the colour of the status bar does not change. Just be careful out there

Categories : Sql Server

How to enable modern look and feel of tool bar for Win32 Application?
Create Toolbar first and then Rebar. the rbBand.hbmBack must be set to NULL to get modern look toolbar, or remove RBBIM_BACKGROUND flag from the code below. Here's how to create rebar: HWND WINAPI CreateRebar (HWND hwndOwner) { REBARINFO rbi; REBARBANDINFO rbBand; RECT rc; HWND hwndCB, hwndRB; DWORD dwBtnSize; hwndRB = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | CCS_NODIVIDER, 0, 0, 0, 0, hwndOwner, NULL, GetModuleHandleW(NULL), NULL); if (!hwndRB) return NULL; // Initialize and send the REBARINFO structure. rbi.cbSize = sizeof(REBARINFO); // Required when usin

Categories : C

Pricing table resize feel like the mac dock using html5 and/or css
You need to add this css on the hover and it will work fine: -webkit-transform: scale(2); -moz-transform: scale(2); -o-transform: scale(2); -ms-transform: scale(2); transform: scale(2); Also add css transitions: -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; -ms-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; Though you will have to have it in a container then vertically align it then add overflow hidden to the container and give it a set height as it will not only expand it how you want width ways but also length ways

Categories : CSS

Can not draw image on JTextArea background when using Nimbus Look And Feel
Basically, when you call super.paintComponent, it will call the UI delgate's update method. This is where the magic happens. Below is the Nimbus's SynthTextAreaUI implementation public void update(Graphics g, JComponent c) { SynthContext context = getContext(c); SynthLookAndFeel.update(context, g); context.getPainter().paintTextAreaBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); paint(context, g); context.dispose(); } As you can see, it actually paints the background, with out regard for the opaque state of the component, then calls paint, which will call the BasicTextUI.paint method (via super.paint) This is important, as BasicTextUI.paint actually paints the text. So, how does that help us? Normally, I'd crucify someone for no

Categories : Java

Search or filter a large data set so it doesn't feel like UI is frozen briefly
The thing that is making it feel slow is not search/filter but actually rendering the results. Ember list view is a good solution, it's pretty easy to add it to your example. Add the ember-list-view library and the required css: <script src="http://builds.emberjs.com/list-view/list-view-latest.js"></script> <style> .ember-list-view { overflow: auto; position: relative; } .ember-list-item-view { position: absolute; } </style> Replace handlebars {{each}} block in your template with ember-list-view, still using view.filteredList as the content: {{#collection Ember.ListView contentBinding="view.filteredList" height=100 rowHeight=20 width=500}} {{name}} {{/collection}} Thats it. Now search starting with 'A' returns lightning fast, nothing locks up. Try

Categories : Ember Js

Django Rest Framework make OnetoOne relation ship feel like it is one model
What you want is nested relationships like { "url": "http://example.com/api/users/1", "username": "demo", "first_name": "De", "last_name": "mo", "email": "demo@example.com", "profile": { "url": "http://example.com/api/userprofiles/1", "mobile": true, "favourite_locations": [ "Paris", "London", "Tokyo" ] } } To have a similar result, you need to first have a accessor to the user profile, you can use User.profile but it will raise an exception if the user doesn't have an associated profile yet, so there is a little helper : class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) User.user_profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0]) Ne

Categories : Django

MATLAB - Can I make my handle object behave like a graphics handle?
Example: MyObject.m classdef MyObject < handle properties x end methods function obj = MyObject(x) if nargin < 1, x = NaN; end obj.x = x; end end end MATLAB >> a = MyObject.empty(0,3) a = 0x3 MyObject array with properties: x >> a(3) = MyObject(10) a = 1x3 MyObject array with properties: x >> a(3) ans = MyObject with properties: x: 10 >> a(1) ans = MyObject with properties: x: NaN Note that the objects a(1:2) were constructed by calling the default constructor with no arguments. An alternative way: >> a = cell(1,3) a = [] [] [] >> a{3} = MyObject(10) a = [] [] [1x1 MyObject] Note: handle graphics (HG) are not implemen

Categories : Arrays

I have worked on Selenium And now i am working on Testcomplete, BUt i feel Playback in TestComplete is very slow, How to Increase it ???Any idea
You can find a list of performance tips for TestComplete in this article on the SmartBear web site. I hope they will help you.

Categories : Selenium

Chrome selection look & feel - how do I "contain" a selection within the boundary of a div?
Just remove "contenteditable=false" from your title spans. At least, that worked for me. EDIT: got it to work. check here. You just have to figure out how to remove the changeable size and the little thing in the corner. textarea { background:transparent; border:none; } textarea:focus { border:none; outline:none; } EDIT EDIT: use this textarea { resize: none; } EDIT EDIT EDIT: okay, finally got it. <p contentEditable="true"><span class="counter" contentEditable="false">1.2</span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras scelerisque molestie nisi, ut accumsan libero rutrum non. Ut non scelerisque lacus. Proin ornare rhoncus lobortis. Nullam id laoreet justo, et bibendum justo. Etiam luctus ligula faucibus, eleifend augue tempor, dapibus nu

Categories : HTML

Setting value to a input field using Jquery val not working.I have commented out code setting value in edit() function
check this fiddle js fiddle here is the code that i have modified. function edit(id){ $("#firstName").val(data[id].firstName); $("#lastName").val(data[id].lastName); $("#city").val(data[id].city); $("#state").val(data[id].state); $("#pin").val(data[id].pin); }

Categories : Javascript

Linux/Unix - Setting default file/folder permissions using ACL, executable permission not setting?
It's not setting the execute bit because files are only created with execute permission if the application explicitly requests it. Since it makes no sense to make an .html file executable, whatever program created it did not request execute permission to be added, so it has no execute permission. Consequently, execute permission from the default ACL effectively only applies to directories, not to files. As for why the default group is not set to ftp, this is more subtle. The default ACL is just that -- an ACL. It's not a default group ownership. As such it shows up not in ls but in getfacl: # mkdir public # setfacl -R -m u::rwx,g:ftp:rwx,d:g:ftp:rwx,o::rx public/ # getfacl public # file: public # owner: root # group: root user::rwx group::r-x group:ftp:rwx mask::rwx other::r-x defa

Categories : Linux

Rails form_for setting options and setting selected option
The parameters of f.select are: attribute_name,option_tags,options. option_tags is supposed to be a string of html option tags. There are some helpers to construct such a string from i.e. an array of values, a collection etc.: options_for_select, options_from_selection_for_select. You have to use one of these helpers. You can get the existing vehicle_sizees with: Model.pluck(:vehicle_size).uniq so your select could look like: <%= f.select :vehicle_size, options_for_select(Model.pluck(:vehicle_size).uniq,@model.vehicle_size) %> See the Rails Guide on form helpers.

Categories : Mysql

What's the rule for preg_match() setting an empty string or not setting?
It depends on whether you make the whole capturing group optional or not. If you make the group required but allow it to match the empty string then the match will always be set, but might be empty: preg_match('/(d)(d?)/', '1', $matches); // $matches[2] === '' If you make the group optional by moving the quantifier ? outside the brackets, the match will be set conditionally: preg_match('/(d)(d)?/', '1', $matches); // no $matches[2]

Categories : PHP

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.