You are not logged in.

ernschd

Beginner

  • "ernschd" started this thread

Posts: 1

Date of registration: Oct 6th 2009

  • Send private message

1

Tuesday, October 6th 2009, 5:03pm

Cursor in Textbox immer schwarz?

Hi,

ich spiele seit einiger Zeit mit Jabaco herum. Nun hätte ich gerne eine schwarze Textbox mit Orange als Textfarbe. Leider verschwindet so der Cursor, da er anscheinend immer schwarz ist.

Gibt es eine Lösung für dieses Problem?

Vielen Dank und Gruß,
Ernschd

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Saturday, October 10th 2009, 9:53pm

Leider kann ich nicht sagen, dass orange Cursor meinen Geschmack treffen.

Aber hier habe ich eine Weg, wie man Cursor orange färbt:

Jabaco Source

1
2
3
4
5
6
7
8
9
Public Sub Form_Load()
   Dim orange As Long = RGB(255, 163, 0)
   Dim black As Long = RGB(0, 0, 0)
   
   Text1.BackColor = black
   Text1.ForeColor = orange
   ' Text1.Parent.setCaretColor(orange)
   Text1.Parent.setCaretColor(Not Orange)   
End Sub


Beim "setCaretColor(orange)" kommt ein inverses orange heraus, das eher nach Türkis aussieht.
Daher habe ich die RGB-Bits als "Not orange" invertiert. Der Cursor sollte ja orange leuchten.

Merkwürdigerweise führt "Color.orange" statt "RGB(255, 163, 0)" nicht zum Ziel sondern wirft eine Runtime-Exception.
Das gehört noch zum unerforschten Java-Land ....

Gruß!

A1880

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

3

Sunday, October 11th 2009, 8:58pm

Hi,

in VB6 ist die Function RGBim Modul Information zu finden. Für Jabaco auch, außerdem gibt es da noch die Funktionen
* ColortoRGB
* RGBtoColor

das mit setCaretColor ist ein guter Tipp.
Frage: sollte man so wie in VB6 die Cursor-Farbe automatisch auf die complementäre Hintergrundfarbe setzen?

die Geschichte mit Not hab ich jetzt in einer MiniFunktion (in Information) gelöst:

Jabaco Source

1
2
3
4
5
Dim orangeColor As Color = Color.orange
Dim orangeRGB As Long = ColortoRGB(orangeColor)
Text1.BackColor = vbBlack
Text1.ForeColor = orangeRGB
Text1.Parent.setCaretColor(RGBtoColor(NotRGB(OrangeRGB)))


Jabaco Source

1
2
3
Function NotRGB(col As Long) As Long
   NotRGB = (&HFFFFFF And (Not col))
End Function


bzw.:

Source code

1
2
3
public static long NotRGB(long RGB) {
   return (long)(0xFFFFFFL & (~ RGB))
}


Grüße

OlimilO

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

4

Sunday, October 11th 2009, 10:22pm

Ganz ohne Gewese geht es so:

Jabaco Source

1
2
3
4
5
Public Sub Form_Load()
   text1.Parent.setForeground color.orange
   text1.Parent.setBackground color.black 
   Text1.Parent.setCaretColor color.orange
End Sub


Aus der Anweisung:

Source code

1
   text1.ForeColor = color.orange


Macht Jabaco den Code:

Source code

1
Text1.$ForeColor(Double.valueOf(Color.orange.toString()).longValue());


Und der geht offenbar, zumindest bei manchen Farben, übel auf die Bretter.
Vielleicht wäre es besser, keine automatische Konversion von Objekten auf "Long" zu versuchen.

Gruß!

A1880

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

5

Monday, October 12th 2009, 1:07pm

Quoted

Vielleicht wäre es besser, keine automatische Konversion von Objekten auf "Long" zu versuchen.

Yes exactly, use

Jabaco Source

1
Option Strict On


Java has a strict type system. VB6 has not. This is why Jabaco has to do some conversions in order to simulate VB-behaviour.

Better not try to assign a variable of type Color to a property of type Long.



OlimilO

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

6

Monday, October 12th 2009, 1:12pm

would be better if we implement Backcolor and Forecolor for variables of type Color

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

7

Monday, October 12th 2009, 1:48pm

When using "Option Strict On", I cannot define variables nor properties of Type "Date".
Have to use "java#util#Date" instead.

Any ideas?

A1880

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

8

Monday, October 12th 2009, 2:23pm

Option Strict On

Yes and No, unfortunately, "Option strict on" does make more other problems at the moment.

But... it is just this: when the compiler detects incompatible types it simply does not compile.
Conclusion is: take care of the types by yourself, be your own "Option strict on" ;)

OlimilO

Rate this thread
WoltLab Burning Board