|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
customizing gui controls
hello guys,
i could need a little help with cusomizing the combobox (kcombo). what is to? - change font (CFont) (worked) - change text- and background color (SetTextColor, SetBkColor) - change style to flat - overload the arrow- bitmap how it should(could) look: https://sites.google.com/site/kxmodu...attredirects=0 thx Last edited by stylus02; Jan 9, 2012 at 05:34 PM. |
|
|
|
|
|
#2 | |
|
HH's curmudgeon
|
Re: customizing gui controls
So, what are you looking for? Opinions?
If so, the one on the right
__________________
Quote:
No trees were harmed in the production of this message.
However, an extremely large number of electrons were rather annoyed. |
|
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
the right one is what i want to have. (it's a not working sketch) now i searched the web how to make the standard windows controls look like this. the kx "kcombo" gives only basic (design) functionality. there are some (extended) attributes to override controls: style, colors, images. maybe someone has experience with it.
|
|
|
|
|
|
#4 | |
|
HH's curmudgeon
|
Re: customizing gui controls
Ahh.... Okay. I've no experience with such work. Looks great though, Good luck.
__________________
Quote:
No trees were harmed in the production of this message.
However, an extremely large number of electrons were rather annoyed. |
|
|
|
|
|
|
#5 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
The kX controls do not always offer/expose all of the functionality of the MFC controls. In such cases just use the MFC control itself. However, recoloring a combobox can get quite complicated. You will have to subclass the CComboBox control. Setting the text color and background color is not too bad, but then you are probably going to want to change the highlighting colors, etc, in which case you will have to do owner drawing. Additionally, if you want to change the arrow, you will have to handle WM_PAINT and draw the borders and arrow, etc yourself. It can get complicated (a pain in the you know what). If at all possible you might want to get rid of the comboboxes and use something else instead.
e.g. If it was just drawing the combobox stuff in WM_PAINT (including the thumb, etc) it would not be too bad, but you do that, and then the colors do not match that listbox part, so you do owner drawing and draw the listbox stuff. Later you see that drawing is being done somewhere else too (e.g. a white selection box is drawn around the text when selected). You decide you will live with that, but then you populate the combobox with multiple strings and now get scrollbars in the listbox part, and it does not match the rest of the custom painting... etc. Last edited by Russ; Jan 12, 2012 at 05:56 AM. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
alternative..
1. the control could be a spintype button (kButton channel_up, channel_down) with selecting and displaying a listitem (midi channel). maybe a kStatic display_channel. 2. in an older forum topic i found, that there is a kTextButton, which is use for the card- selection in the dsp window (preset selection too?) this thing can have different colors, fonts, sizes. LeMury's new DSP mixer (was "KX plugins in SX") (eugene's entries) btw: i had no luck with displaying a simple text in my plugin window using standard expressions like this: // after create_dialog.. CClientDC dc(this); CFont font; VERIFY(font.CreatePointFont(120, "Arial", &dc)); // Do something with the font just created... CFont* def_font = dc.SelectObject(&font); dc.TextOut(5, 5, "Hello", 5); dc.SelectObject(def_font); // Done with the font. Delete the font object. font.DeleteObject(); Last edited by stylus02; Jan 10, 2012 at 08:59 PM. |
|
|
|
|
|
#7 | |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
BTW: The kCombo version does not look bad... And again, it is not too hard to change the text color and background color... It really only gets complicated if you want to change the dropdown arrow thing, or the highlighting, etc.
I am not familiar with the kTextButton... You could do similar using a CStatic control and maybe create a pop-up menu (or listbox) when it is clicked to use for selection, etc. (That is probably what kTextButton is, and how presets, etc are done). Quote:
|
|
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
the standard combobox works perfectly, but you know, it -could- look more realistic in terms of a hardware look. such a displaytext- popupmenu- button would be useful in any other case too. i've found a ttf font "ds-digital" (the font in the sketches) and had it in a dialog with cleartype (antialiasing) option and it looked great. no need to draw 3d borders or that arrow. simply place a colored text object on a prerendered backdrop.
color variation: (graphic sketch) https://sites.google.com/site/kxmodu...attredirects=0 beside that: i downloaded the vstgui library and overlook it. http://sourceforge.net/projects/vstg...atest/download Last edited by stylus02; Jan 11, 2012 at 10:02 PM. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
after hours trying to understand sdk classes of type "kclass" i realised that there only a few corresponding functions are working / documented (e.g. create_ (kxplugingui.h)). is it possible to define new functions using all sdk classes or are they linked to external libraries or whatever?
CStatic stuff is used in "dynamic" or "mx6" (no kStatic?) i think i can grab some stuff from it for my purposes. anyway, i found a really nice looking dot matrix display code. maybe we could implement such a thing in future? ![]() Digital Display CStatic control - CodeProject® Last edited by stylus02; Jan 13, 2012 at 04:18 PM. |
|
|
|
|
|
#10 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
Well there is more functionality than just the create stuff. If you look in the header files for each type of control and the base classes you can find more stuff. But yeah, some of the kX controls are a bit limited, and you cannot really extend their functionality much.
In any case, again, you do not have to use the kX classes, you can use MFC controls (which you can subclass and extend/modify functionality, etc), or create your own derived from CWnd (e.g. like I did with the dot matrix display in FxRouter), etc, or use something you find at places like CodeProject, etc. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
i had not yet a closer to your fx- router plugin. times ago i noticed a graphical user interface with dot matrix display (and a drag&drop routine) that is a bit to "biggy". but if it's customizable it could be what i'm looking for. nice tip!
![]() i can imagine such a display what shows a selected array element (midi device, midi channel) via 2 buttons (up, down). Last edited by stylus02; Jan 13, 2012 at 07:48 PM. |
|
|
|
|
|
#12 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
Well I wasn't suggesting that you use that, I just meant to show it as a example that you can do pretty much whatever you want (make your own or use the one from the CP site, etc)... that you are not limited to just the kXGUI stuff.
BTW: I generally use a basic dialog application in Visual Studio to create and test my controls, etc, as you have access to the classwizard, and applying changes and recompiling and testing/debugging is much faster/easier (than testing in a plugin in kX DSP, etc). Last edited by Russ; Jan 13, 2012 at 08:38 PM. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
how could it look:
https://sites.google.com/site/kxmodu...attredirects=0 using the wizzard and that toolbox stuff is pretty much straight forward (i have no really experience with it), but if i combine something with kx i get stuck. classes, memberclasses, base classes.. you know. it's to much to have a quick overview. i'm better in designing some nice graphics than going into deep with winapi, mfc and so on. Last edited by stylus02; Jan 13, 2012 at 08:38 PM. |
|
|
|
|
|
#14 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
Looks nice, but don't forget what it is being used to display... 7 characters is probably not going to be enough to show anything meaningful, is it? e.g. You do all the work to make it all look nice, etc and all it says is "In From", etc.
Last edited by Russ; Jan 13, 2012 at 09:09 PM. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
that should not the biggest problem. tweaking size, colors etc. is to fetch later. btw: you have build in an edit- mode. it's quite comlete. but it is not included in the sdk. ( i found no sourcecode in 3545, 3550)
for better understanding the rendering, i do the 3d construction parallel to the placements of the controls. if the code changes it can easy updated in den 3d scene by moving all that objects (no textures, expect the the bumpmaps and the pixelpatterns (which are placed on 2d- shapes too)). it's qiute similar to the use of "friendly- looking" functions in our codes. the render takes a few seconds thanks ghz- cpu's. Last edited by stylus02; Jan 13, 2012 at 09:29 PM. |
|
|
|
|
|
#16 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
Well if that is what you want to go with you could probably use that code from CodeProject and modify it to use your own bitmaps/size for the characters, etc.
As for FxRouter. I am not even sure I have the source code for that any more... My hard drive croaked a while back and I lost a lot of stuff (I might have to ask E. to send it back to me). I think parts of it were included in older versions of kX (like 3538j). In any case, it is probably not something you would want to use for this, as it size (height) is fixed. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
if it's lost it would be very painful. and it was surely a lot of work for you. i have older driver- versions from 3534 - 3550.
maybe is everything available. you mean the x/y ratio of the letters are fixed or generally its hight. were you are using a bitmap charset? Last edited by stylus02; Jan 13, 2012 at 09:50 PM. |
|
|
|
|
|
#18 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
No, I did not use bitmaps, everything is drawn manually (character width and height is fixed (each character is something like 22x17 pixels), so the control's height is fixed (IIRC, 32 pixels) and it's width is determined by how many characters you want to display (i.e. number of character times character width, plus width of the borders, etc)).
i.e. In it's create function, you basically just specify the point for the top-left and how many characters you want, etc. Part's of it are there (e.g. I know the LCD code is there (in 3538j I think) cuz I remember someone asking about it in the forum), but not all the code (not sure why E. didn't include it all... maybe cause it is not likely stuff people would use in other plugins, etc). In any case, E. should still have it since the plugin is bundled with kX. Last edited by Russ; Jan 13, 2012 at 10:12 PM. |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
i see the difficulty. all the characters have to drawn with new coordinates. this must be a nice array... this code project thing is bitmap based (and it scrolls longer content.. well you are right). it compiled, but it it uses some more .h, .cpp files which i was unable to implement yet in kx. what i'm doing now is make that button functionality working and then we will see.
Last edited by stylus02; Jan 13, 2012 at 10:29 PM. |
|
|
|
|
|
#20 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
I only took a quick look at the code, but I think you should only need the MatrixStatic.h and MatrixStatic.cpp files and modify the code to load the bitmaps from the skin (or maybe from disk for testing) instead of from the resource file.
If I have the chance I will take a look at it (I am on a laptop atm with no kX). |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
there is no rush.
|
|
|
|
|
|
#22 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
OK, I tried it in kX and it worked pretty much as it is...
The only problem I had was I could not really figure out a way to load the bitmap(s) stored in the skin in such a way that it loads as a ColorMappedBitmap (or DIBSection, which would work too (using SetDIBColorTable)). In any case, including the bitmaps as a resource (as in the example code) worked fine, so I just did that. You just need to change: Code:
//from
bmp = ::CreateMappedBitmap(AfxGetInstanceHandle(), m_iImagematrix, 0, ColorMap, 3);
//to
bmp = ::CreateMappedBitmap(GetModuleHandle("yourPlugin.kxl"), m_iImagematrix, 0, ColorMap, 3);
Picture Here are the files I used for testing... Last edited by Russ; Jan 14, 2012 at 05:07 PM. Reason: add files link |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
have it working, great! without the new codeline i had only a black rectangle. some people on code project replied they had the same problem. (which driver version did you use? i still do it on 3545.)
|
|
|
|
|
|
#24 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
I have 3550 installed, but I think I used the 3548 SDK (mainly because I already had VCExpress setup for it).
|
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
@russ the display is integrated in the 120. i added some textfilter functionality (remap text, add spacer, autoscroll). the only thing i don't get right is the update of the -not scrolling- display text when a window overlappes. must have to do with the paint dc. everything else is fine.
Last edited by stylus02; Jan 20, 2012 at 03:48 AM. |
|
|
|
|
|
#26 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
Hmm, I do not have that problem so it is hard to say what might be wrong...
Does the original demo project from CodeProject have that problem for you if you change one of them to not scroll? I tested with the original demo project and my test plugin (just commenting out the DoScroll lines, so it is set to not scroll) and I did not see any problems. How are you creating the controls? When you are using more than one, are you giving each one a different control ID? How much did you change to add your new functionality? |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
i'm not on the kx- pc. upload my demo tomorrow.
https://sites.google.com/site/kxmodu...edirects=0&d=1 i changed id's from "101" to "display_id..", colordepth of bitmap to 24bit, FilterInput(text[i]); (maybe a problem with the textarray? text[] is a cstring). Last edited by stylus02; Jan 20, 2012 at 03:43 PM. |
|
|
|
|
|
#28 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
OK, I see a couple of problems.
First, your bitmap has a 256 color palette (with (IIRC) 15 colors used). The original bitmaps were only 16 color (3 colors used). The code that changes the colors only changes the 1st 3 colors (and expects them to be in the correct order). Thus setting colors using your bitmap is not gonna work correctly (only 3 colors are gonna change and they are probably not gonna be the color you wanted to change). If you want it to work right with your bitmap, you would probably have to modify the code to change all 15 colors, but that would make using it more complicated (e.g. you have to set all 15 colors in code, etc). Also, your project uses the demo project and builds everything as demo.dll (later renamed). This is causing an issue with GetModuleHandle (i.e. if you keep it named demo.kxl (with GetModuleHandle("demo.kxl"), it seems to work correctly), but renaming it (and using the new name with GetModuleHandle) does not seem to work. With your bitmap you might just consider getting rid of the ability to change the colors in code since it is not gonna work correctly as it is right now (i.e. just use colors from the bitmap). That would eliminate the need to load it as a ColorMappedBitmap, and thus you would not have to include it as a resource (you could just load it from the skin), and would get rid of the need to use GetModuleHandle, etc. BTW: The "_T" is for string literals (not needed when you pass in a CString variable). |
|
|
|
|
|
|
|
HardwareHeaven Addict
Join Date: Jan 2008
Location: germany, sb0090
Posts: 259
Rep Power: 0 ![]() ![]() |
Re: customizing gui controls
i fear you got an older source, sorry. the rename problem was known and fixed. tried out 16 colors (original bitmap), same problem. color changing is not needed so i could cut it out. loading the bitmap with the skin would be smart. all the colors can be done in a 2d graphic program. i really want use 8 or 24 bit to include some effects (lightning, reflections) that are already in the bitmap. new question is how to load and make it all work within CMatrixStatic/ iDemoPluginDlg?
beside that: yesterday i've noticed, that i left out/ not included CMatrixStatic::OnPaint();return TRUE; (iDemoPluginDlg::init() ) simple putting in brings errors (illegal call of a nonstatic member & void returns a value) (this problem has not that high priotity. what i have is a good starting point for a really nice looking gui.) something for your eyes guys, if you're bored from sourcecode- discussion. ![]() https://sites.google.com/site/kxmodu...attredirects=0 Last edited by stylus02; Jan 21, 2012 at 03:04 PM. |
|
|
|
|
|
#30 |
|
HardwareHeaven Extreme Member
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62 ![]() ![]() ![]() ![]() ![]() ![]() |
Re: customizing gui controls
Here are the changes I would probably do: Changes
Removed the coloring stuff (except background (which defaults to black)). Removed the "large, small, tiny" stuff and just made the default size the tiny size (as that is what your bitmap uses). You can use SetSizes function to modify the sizes for other bitmaps (or modify the code). As for the "CMatrixStatic::OnPaint();return TRUE; (iDemoPluginDlg::init() )" stuff, I do not understand (I do not know what you intend to do with the above)... In any case, you should not need to call OnPaint, if you want to force a redraw, use Invalidate or RedrawWindow, etc. |
|
|
|
![]() |
| Thread Tools | |
|
|