I have a wxWidget Application. I need to make certain changes to the layout of the application. One of them being adding horizontal lines between vertically stacked slider.
Here is the code I am using:
m_BrightContLine =new wxStaticLine(this,wxID_ANY,wxPoint(-10,10),wxSize(250,1),wxLI_HORIZONTAL,wxStaticLineNameStr);
gridSizer->Add(m_DummyText[16], 0, wxALL);
m_BCLineSizer = new wxBoxSizer(wxHORIZONTAL);
m_BCLineSizer->Add(m_BrightContLine, 1, wxALL|wxALIGN_LEFT|wxEXPAND);
gridSizer->Add(m_BCLineSizer, 0, wxALL|wxEXPAND);
the problem is that the static line expands both in length and in thickness.
How do I make sure that it expands only horizontally(in length).
Take out the wxEXPAND flag.
m_BCLineSizer->Add(m_BrightContLine, 1, wxALL|wxALIGN_LEFT);
If that doesn't work, try the wwxSHAPED flag
m_BCLineSizer->Add(m_BrightContLine, 1, wxALL|wxALIGN_LEFT|wxSHAPED);
Related
I am using androidplot in a wind application
I would like the lines at (as an example since they vary according to wind)
1,3,5,7 to make the horizontal lines different color (all 4 lines same color) and thicker.
For the series i use:
dynamicPlot.addSeries(SpeedSeries, new LineAndPointFormatter(Color.BLUE, null, null));
I am using library androidplot-core-0.5.2.jar
A small piece of code will be appreciated
Probably the easiest way to accomplish this would be to add markers. For example, to add a red line for "3":
Paint markerPaint = new Paint();
markerPaint.setColor(Color.RED);
markerPaint.setStrokeWidth(PixelUtils.dpToPix(4)); // line thickness
plot.addMarker(new YValueMarker(3, null, null, markerPaint, null));
I'm using FLTK for a project (the version distributed with Debian/sid 1.3.2-6+b1) and I'm having some trouble initializing Fl_Scroll's content scroll values.
I create a Fl_Double_Window and on the right side a vertical panel using Fl_Scroll, it is positioned at left x 600 and top y 24.
Then I set Fl_Scroll's type to Fl_Scroll::VERTICAL and place a Fl_Button inside, everything works fine.
The problem? Fl_Scroll initialize already scrolled with xposition() = 600 and yposition() = 24 (X and Y of the Fl_Scroll's constructor?? Is supposed to work so?), instead I want it to initialize with content scrolled at left and top 0, 0, so I tried scroll_to() in different places, before and after window's show(), on FL_SHOW of the subclassed Fl_Scroll (I didn't really need to subclass Fl_Scroll, just trying to get scroll_to() working), also on overridden draw() after
the parent draw(), even creating Fl_Scroll at 0, 0 then position() at 600, 24, but nothing.
The only way I got scroll_to() working is if I call it from an async event after the application initialize (FL_KEYUP).
Here's the overridden Fl_Double_Window window constructor:
group = new Fl_Group(0, 0, WIN_W, WIN_H);
{
menu = new Fl_Menu_Bar(0, 0, WIN_W, MENU_H);
menu->add("File/Quit", FL_CTRL+'q', cbMenuQuit_i);
glview = new CGLView(0, MENU_H, WIN_W-PROPS_W+1, WIN_H-MENU_H);
group->resizable(glview);
scroll = new CScroll(WIN_W-PROPS_W, MENU_H, PROPS_W-1, WIN_H-MENU_H);
scroll->type(Fl_Scroll::VERTICAL);
{
Fl_Pack *pack = new Fl_Pack(0, 0, PROPS_W-1, WIN_H-1);
{
btnAddLayer = new Fl_Button(0, 0, PROPS_W, 32, "##+ Add Layer");
btnAddLayer->callback(btnAddLayerCb_i, (void *)this);
}
pack->end();
}
scroll->end();
}
group->end();
end();
size_range(WIN_MIN_W, WIN_MIN_H); /* Make the window resizable */
show();
Never mind, got it, two altenative:
create Fl_Scroll at 0, 0 then position() it after scroll->end()
create Fl_Scroll at the wanted position then after scroll->end() use negative values scroll_to(-X, -Y)
In both cases is important that the widgets contained are already added (scroll_to() alter cotained widgets coords)
Isn't clear to me why X and Y of Fl_Scroll's constructor are used.
I am making my first application for BlackBerry (OS 6.0+) and I have to define a screen like in the image below. I have read about RichList but its not allowed to be added below the other components.
What I want is the part (list) below the wide ButtonField. The white boxes should contain images and the scribbles in front of it should contain text. This "list items" are populated dynamically.
As you can see, this very-much resembles the layout of a RichList, but I can't seem to add it to the VerticalFieldManager that I have used as the main container of components.
So if anyone can help me get this screen, I'm really grateful! Thanks in advance.
You need to implement ListFieldCallback and overwrite all methods. There you will see "drawListRow" method. You need to draw Images on left and text on write on this method index wise. like this:-
ListData ld = (ListData) rows.elementAt(index);
g.drawText(ld.name, 30+extraSpaceDelete, y
+ (listItemHeight - g.getFont().getHeight()) / 2);
g.drawText(ld.address, 30+extraSpaceDelete, (y
+ (listItemHeight - g.getFont().getHeight()) / 2)+(g.getFont().getAscent()+10));
g.drawBitmap(0, y + listItemH - 3, Display.getWidth(), 3,
separator_line, 0, 0);
I'd like to have a manipulate control, something like
{{wAB, 1, "AB"}, 0, 1, Appearance -> "Labeled"},
but would like the A and the B to be different colors, say, Red and Blue.
I can change the overall color with Style["AB",Red], but haven't been able to get the A and the B in different colors. Any help would be appreciated!
you mean like this?
Manipulate[
wAB,
{{wAB,1,Row[{Style["A", Red], Style["B", Blue]}]},0,1,Appearance->"Labeled"}
]
and if you prefer to define the decoration part separately (which can be useful for larger and more complicated controls) and reference it in controls later on (like declaring a variable, sort of, but it is a macro actually) and reuse it for different controls, then you can use With, like this
Manipulate[wAB,
Evaluate#With[
{myStyle = Row[{Style["A", Red], Style["B", Blue]}]},
{{wAB, 1, myStyle}, 0, 1, Appearance -> "Labeled"}
]
]
Although it is safer to do styling with Style you can actually color the characters of the string directly using the Format menu or keyboard shortcuts, and Mathematica will preserve it in the dynamic control:
If vertical position is x, you must print one letter on x, then count width (w) and print next letter with another color on the new position x+=w.
BitBlt(meteor.main, 0, 0, meteor.img_width, meteor.img_height, meteor.image, meteor.mask_x, meteor.mask_y, SRCAND);
BitBlt(meteor.main, 0, 0, meteor.img_width, meteor.img_height, meteor.image, meteor.img_x, meteor.img_y, SRCPAINT);
BitBlt(buffer, 0, 0, 800, 600, meteor.main, 0, 0, SRCCOPY);
I know the first two bitblts make the transparancy, but the third removes it! What am I doing wrong here?
SrcCopy just flat copies everything from source to destination. Whatever was in your destination will now contain everything form your source.
The way I usually do this is
1) BitBlt(dest.hdc, dest.x, dest.y, width, height, srcMask.hdc, srcMask.x, srcMask.y, MergePaint)
This will essentially cut a hole, in the form of the mask, into the destination.
2) BitBlt(dest.hdc, dest.x, dest.y, width, height, src.hdc, src.x, src.y, SrcAnd)
This basically overlays the source on top of the destination.
If your source contains more image than what you want to overlay, you may first want to cut out all that is around your source first (before step 2.) using SrcPaint like this:
1b) BitBlt(src.hdc, src.x, src.y, width, height, srcMask.hdc, srcMask.x, srcMask.y, SrcPaint)