19. april 2003 - 14:30Der er
15 kommentarer og 1 løsning
Undgå Cursor
Kan jeg undgå den blinkende cursor i den aktuelle post i en fortløbende formular og i stedet markere den aktuelle post ved f.eks. at ændre baggrundsfarve?
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
Om du lige kan slå cursoren fra, kan jeg ikke huske (er på arbejde uden Access på denne maskine). Men du kan skifte cursorens udseende. Du kan sagtens skifte farve på den aktuelle post, ved at indsætte koden i formularens OnCurrent (VedAktuel) event. Prøv at søge i tidligere spørgsmål, så finder du koden. Eller jeg kan sende dig den når jeg kommer hjem Kl ca. 20:00
Hej. Skifte farve på den aktuelle post, ved at indsætte koden i formularens OnCurrent (VedAktuel) event. Dim lngRed As Long, lngYellow As Long, lngBlack As Long, lngWhite As Long lngRed = RGB(255, 0, 0) 'Rød lngYellow = RGB(255, 255, 0) 'Orange lngBlack = RGB(0, 0, 0) 'Sort lngWhite = RGB(255, 255, 255) 'Hvid If IsNull(Me.Navne) Then
Navne.BackColor = lngRed End If Me.Navne.Requery Dette ex. er lavet til felted Navne. Som mugs skrev. Men jeg mener ikke den virker i en fortløbende formular.
En formular opnår status af OnCurrent hver gang du skifter post! Koden fungerer også i fortløbende formularer, men på den måde, at alle poster skifter farve afhængig af værfdien i Current Record
Ja det er jeg klar over, men alt det her har dybest set ikke ret meget med mit oprindelige spørgsmål at gøre, så det vil jeg gerne vende tilbage til :-)
Here is part of the solution! You have to use conditional formatting which is available in XP and I also think in 2000. Open the form in design view and select all fields in the detail record. Now select Conditional formatting from the formatting menu. You should now see "Condition 1" over a combo box. In the combo box choose "Field has focus". Now you can choose the colour/font you want to use when the field gets the focus. It DOES NOT select the whole record!
to switch of the cursor you will VERY likley need to use API calls. Here is one I found which may allow you to reduce the size so that it is not visible.
The API function has to be declared in your program for example: Private Declare Function apiCreateCaret Lib "user32" _ Alias "CreateCaret" _ (ByVal hWnd As Long, _ ByVal hBitmap As Long, _ ByVal nWidth As Long, _ ByVal nHeight As Long) _ As Long
then it sjust a case of calling the function with the cortrect paramaters.
Ja ved tidligere lejjigheder og det fungerer fint, men det største problem var også cusoren, så nu vil jeg se om jeg kan få koden i dit link til at virke. Foreløbig tak.
Private Declare Function apiCreateCaret Lib "user32" Alias "CreateCaret" (ByVal hWnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function apiGetFocus Lib "user32" Alias "GetFocus" () As Long
Private Declare Function apiShowCaret Lib "user32" Alias "ShowCaret" (ByVal hWnd As Long) As Long
Function fhWnd(ctl As Control) As Long On Error Resume Next ctl.SetFocus If Err Then fhWnd = 0 Else fhWnd = apiGetFocus End If On Error GoTo 0 End Function
Sub sMakeCaret(ctl As Control, intX As Integer, intY As Integer) Dim hWnd As Long hWnd = fhWnd(ctl) Call apiCreateCaret(hWnd, 0&, intX, intY) Call apiShowCaret(hWnd) End Sub
then in the Got focus event for each field you use
sMakeCaret Me.TheNameOfYourField, 0, 0
You will very likley see a VERY small cursor but its almost invisible :o)
it is VERY likley possible but I havnet found a solution. If I do then I will post it here!
og selv tak :o)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.