dkl
Full Member
Posts: 234
|
Post by dkl on Aug 24, 2021 21:24:59 GMT -5
In my GUI I have used.......
BackgroundColor$ = "black". This means that to see anything that is written via a 'statictext' command cannot be seen so...... Foreground Color$ = "white". I can see my 'Statictext' now. But....... I cannot see anything in my text boxes. So.......... TextboxColor$ = "darkgrey", I can now see any entries into my Textboxes. But...... I cannot see the cursor in the textbox.
I have used '!setfocus" to place the cursor in the relevant textbox, but as I have numerous textboxes, I would like to visually see where it is. How can I do this? It also seems that the only way to alter font colours is by using ForegroundColor$. Is there another way?
I have done a few searches and I saw Rod's Change window BackgroundColor and ForegroundColor on the fly. But its not quite what I'm looking for.
|
|
|
Post by Rod on Aug 25, 2021 3:35:16 GMT -5
Using those background and foreground colors I see a white or black text cursor depending on the color of the textbox. The text caret or text cursor is a thin vertical bar. On a modern Windows system it blinks only a few times then lies idle but is still in view. Can you see the thin vertical line at the very left of your textbox?
Use Windows Settings, Ease of Access, Text Cursor to see options for the text cursor.
So is the problem that the text cursor is too small or is it being rendered in the background color?
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Aug 25, 2021 7:45:39 GMT -5
It seems to be rendered in the background colour?
|
|
|
Post by Rod on Aug 25, 2021 11:41:05 GMT -5
Is the textbox height large enough for the font? Can you code a short demo that replicates the problem?
|
|
|
Post by Walt Decker on Aug 25, 2021 12:19:18 GMT -5
This is interesting. I just posted info on how to "roll your own" in the GENERAL DISCUSSION thread under "What you do not want to know."
Anyway, if you are having trouble with the caret, why not "roll your own?"
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Aug 25, 2021 22:04:34 GMT -5
It's a minor problem really, but has often bugged me. I you change foreground colour that it affects the statictext color and the statictext colour as well as the font IT's not STYLEBITS causing the problem (in this case )is it?
WindowWidth = 400 '350 WindowHeight = 250 '470 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)-200'-310 width = 400:height = 600 x = 10:y = 80:w = 220:h = 30 BackgroundColor$ = "black" ForegroundColor$ = "white" TextboxColor$ = "darkgray" button #1.ok, "OK", [IMDB1],UL, 280, y, 30,h button #1.cl, "Clear", [clearIt],UL, 315, y, 40, h stylebits #1.ok, _BS_DEFPUSHBUTTON, 0, 0, 0 stylebits #1.in, _ES_CENTER, 0, 0, 0 '<-centres text statictext #1.i, "Input Title", x , y-15, w, h textbox #1.in, x, y, w+45, h [openGUI] '<- open Main GUI open "IMDb WebScraper" for window as #1 #1 "font georgia 10" #1.in,"!setfocus" wait
I would prefer to have background = black textbox = grey font colour = black static text white
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Aug 25, 2021 22:10:35 GMT -5
Thanks Walt, I've downloaded the zips and will give it a look. I generally steer clear of API's and dll's. Still haven't got the hand of them!
|
|
|
Post by Chris Iverson on Aug 26, 2021 1:12:11 GMT -5
It's not really something that can be worked around besides using a different color. The problem is the way that the text caret(and the I-bar cursor) color is generated by the system. The system tries a simple way to make sure the caret(and the cursor) will always be visible, no matter what color you choose. It does this by inverting the color. Flip every bit in it to the opposite. (Effectively, this is like taking each color component, and subtracting it from 255.) (You can get examples of inverting colors here: pinetools.com/invert-color ) The problem is, there is one type of color where that doesn't work very well: greys. Why? Because greys are halfway in the middle on the color scale. "darkgrey" corresponds to an RGB value of 128, 128, 128 for each of Red, Green, and Blue. Take that, and invert it, and what do you get? 255 - 128 = 127. Your "inverted" color is RGB 127, 127, 127. It's a different color - but not visibly so. Go even just a little bit further out, and it starts becoming visible. Unfortunately, LB doesn't have very much in the way of specifying GUI widget colors. You're limited to the 16 built-in to LB, unless you start playing with API or DLL calls.
|
|
|
Post by Rod on Aug 26, 2021 5:05:40 GMT -5
I did read that the cursor color is a registry setting. But that’s outside my skill set.
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Aug 26, 2021 7:16:57 GMT -5
I see....thank you for explaining that. Now, I understand why it's limited. I'm not so bothered about what the colours are and I can work around the caret,but unless I'm doing something wrong, it means that font colour is always going to be the same colour as the ForegroundColor$. Is that correct? There is no way of changing the font colour? I don't want to go into the realm of using graphics to change the text colour. In my limited experience, it always seem to limit how/where you position the graphics/text! But I could use disabled 'buttons' or 'bmpbuttons' to replace the statictext then I'd get my font colours back! Can you change the colours of 'buttons' or are you stuck with grey? Have a good day
|
|
|
Post by Walt Decker on Aug 26, 2021 9:27:16 GMT -5
Unless you use API you are stuck with the colors defined by LB for ALL controls. Native LB gives you no choice.
Do you mean caret?
|
|
|
Post by Rod on Aug 26, 2021 10:37:18 GMT -5
|
|
|
Post by Walt Decker on Aug 26, 2021 11:47:29 GMT -5
Perhaps I am old fashioned. To me the indicator in an edit control is a caret, the indicator that is common to the monitor is a cursor.
That is interesting. However, it requires 1) that the end user knows about the feature and 2) take more actions than is really necessary.
|
|
|
Post by Chris Iverson on Aug 26, 2021 12:06:01 GMT -5
Also, it's using a global solution to solve a local problem.
"The colors I chose for my app don't work right on default Windows settings, so please go into your control panel and customize some colors across your entire Windows UI experience."
dkl, if you're interested, I actually did make a DLL specifically for changing the colors of a specific textbox to any arbitrary color you want. I'd be happy to provide it and an explanation on how to use it. Unfortunately, this still won't change the way the caret and the I-beam cursor behave.
|
|
|
Post by Rod on Aug 26, 2021 13:49:13 GMT -5
To be clear, I am not promoting special color change, just mentioning it is possible. My normal stance is to leave well alone and adopt the users choice of default colours. Thats the design ethos of Windows, the user is in charge of the display color not the programmer.
|
|