

Squall_FF8
Members-
Content Count
77 -
Joined
-
Last visited
Everything posted by Squall_FF8
-
Solid advice! Since I'm stubborn when I feel I'm so close, I decided to test all types (that make sense) - time, time 0..7 and datetime variants. From the 14 possibilities, only 2 gave me (The rest was tWideString): QryHour: TSQLTimeStampField; Browsing MS SQL types page I stubbled upon: So maybe it is ok to get WideStringField. On the other hand, Date formats return SQLTimeStamp ...
-
Update: Sorry guys for the delay but we had a break (National holidays). So I thought that the problem comes from my weird setup: Delphi 12.2, 64 bit application, no design time info for TFDConnection, no SQL for TFDQuerry, all done in run-time. After @Uwe Raabe showed me tTimeField, I decided to play by the book: a new 32 bit app, (because Delphi IDE is 32) design time connection + query (with SQL) , Auto-created fields in design time. All of the fields got appropriate type (Int, Date got TSQLTimeStamp, Currency,..) except the Hour field: QryHour: TWideStringField; If it matters, the MS SQL is old 2008. I also tried to cheat with static field, but the result was the same (error message after opening the query) This leads me to the conclusion: Delphi 12.2 has a bug for MS SQL 2008 when the type is time(7). Unfortunately I cant change the type (easily) to experiment with other time versions or even try DateTime for Time portion. P.S. @Uwe Raabe, I tried your suggestions for mixing static dynamic fields - no result. Sorry but I have to ask - what version is your Delphi and are you using time(7) in MS SQL?
-
Name=Jet DriverID=MSSQL Server=192.168.0.169 Database=xxx User_Name=xxx Password=xxx FDConnection is all default - (after you drop it on the form)
-
The screenshot shows that this is in Design time. Could you try that at runtime? The connection need to be closed on start, and activated with a button. Also the query to have at least 2 fields (Hour and whatever) (so we have a static and dynamic fields at the same time).
-
BTW I'm not sure is it related, but the Query and the Fields are dynamic. The columns are static. I did this because I needed custom labels for titles Here is the CD_Main ... As you can see I have plenty of types, yet they all come as WideString (after Open) CREATE TABLE [dbo].[CD_Main] ( [ID] INT IDENTITY (1, 1) NOT NULL, [ForWho] NVARCHAR (100) NULL, [Dates] DATETIME NULL, [Category] INT NULL, [Sum] MONEY NULL, [Notes] NVARCHAR (200) NULL, [Hour] TIME (7) NULL, ... CONSTRAINT [PK_CD_Main] PRIMARY KEY CLUSTERED ([ID] ASC) );
-
sure I can .... but I doubt there is a hint (for a problem) in it: Hour is a field of CD_Main. Personally I think the problem is from FD engine ... it returns all fields as WideString instead of appropriate type. const sql_Base = 'SELECT '+ ' m.*, cat.Name Categories, t.Name City,'+ ' c.Name FirmName, c.EIK FirmEIK, c.Address FirmAddress, '+ ' c2.Name ToFirmName '+ 'FROM CD_Main m '+ ' left join CD_Category cat on (cat.ID = m.Category) '+ ' left join CD_Town t on (t.ID = m.Town) '+ ' left join CD_Company c on (c.ID = m.Firma) '+ ' left join CD_Company c2 on (c2.ID = m.ToFirm)';
-
Hehe easier to say then do 🙂 Any hints? Why all fields are WideString? BTW that is tFDQuerry connected to tFDConnection.
-
I tried (long ago)... for unknown reason the quarry returns WideString instead of Time. And I dont know how to force the right type ...
-
Judging by the explanation, I would suggest that your design (using what component for what) is wrong! 1st Method: you want to use two thumbs on one track. The values that each thumb represent are the values that track represent. So first is Position - that is fine. But second is Length - it has nothing to do with the track (which represent position in the text). Your picture would make sense if the two thumbs are Start/End position. 2ndMethod. Using TrackBar in general is inaccurate - most likely you cant get with the thumb, all values that you need. The larger is the set that you want to represent, the higher probability is. The reason for that is the rounding error between thumb position on screen and resulting set. If the set has more elements then the length of the bar (in pixels) you will have 100% inaccuracy. SpinEdit on other hand is 100% accurate - with keyboard or mouse you can get all values that you need. So I would suggest to use 2nd Method with changing controls - use SpinEdit for Position in text (since text could be HUGE) and Trackbar for Length. P.S. I'm not sure about latest iterations of Delphi (10+) but in the past RxSpinEdit had some nice tricks with mouse (compared to stock SpinEdit).
- 7 replies
-
- delphi xe7
- trackbar
-
(and 1 more)
Tagged with:
-
Hey guys, I have a tDBGrid that I try to paint the selected row similar to the picture bellow. May you advise/share a snippet of how to do it? dgRowSelect is false!
-
Thank you very much for the solid advice! For completeness and people with the same problem, the solution is is simple: type TDBHackGrid = class(TDBGrid) public property Col; property Row; end; Then in your app you just compare: if Row = HackGrid.DataSource.RecNo then // code for coloring the row
-
Woah, you saved the day!!! I tried it and it works! That trick actually doesn't require to make a new class, install components, do hacky things!. It is enough in your app to write a handler for OnDrawColumnCell !!! Event the handler is almost the same: if not (gdSelected in State) and Grid.SelectedRows.CurrentRowSelected then Grid.Canvas.Brush.Color := TColor($FFFFA0)
-
That part is quite hacky ... When I change in the form and try to go back to pas, I get error in the IDE. The project compiles and works well, but I need to save first, close the project and then open it again
-
Only in the .pas. I cant find in Delhi12 how to view the .dfm as text EDIT: found it and it works, Thanks!!!
-
So that is why I couldn't find the answer in my google search ... For me the problem is twofold: - Row/Col are private - no Row info in DrawColumnCell if we had that (which is quite reasonable for me), it is a matter of simple comparison. BYW Let say I implement a descendant and call it TMyGrid, is there an easy way to replace the TDBGrid in existing project? I tried to manually replace "Grid: TDBGrid;" in the source but it didnt work
-
Hi guys, I use TDateTimePicker, but I cant find a method to "nullify" it. The value will be passed to SQL query, so I would like to be able to pass Null. P.S. I have 2 pickers, one for date and one for time. They both should be able to pass "no value" (null).
-
Hi guys, I'm trying to connect my application to MS Access DB. If the file is with ".mdb" format - everything works fine. However I need to use the "accdb" and so far - nothing worked (ADO/FD connection). Can you advise how to do it? P.S. if it matters, I will need read/write to DB, but no exclusive.
-
Hi guys, This one was suppose to be easy, but I cant setup a TFDConnection to connect to .accdb. Is it possible? How to do it? For looong reasons in my other post , I ended up with 64 bit application that tries to connect in runtime. First I tried with ADO - all worked. I love using FireDAC, so I'm trying to do it with TFDConnection, - alas no success. If it matters, here is ConnectionString for ADO: Provider=Microsoft.ACE.OLEDB.12.0;Password="";Data Source=xxxx.accdb;Persist Security Info=True;Jet OLEDB:Database Password=xxxx
-
Thank you very much, Mark! This is the starting/reference point I needed. It seems I started with wrong DriverID, and thus no chance to make it.
-
Hehehe, nice one 🙂 Thank you for the links! I'm sure they will come in handy (the download in the second one doesnt work). Especially I would like to try the "/passive" trick with 2013 or 2016 32 bit drivers.
-
It will be very helpful to see a snippet of how to setup the connection with code (at runtime). What i did? Well unlike MS SQL, I have no clue what property I need to set for Access. So I setup DriverID = MSac, then I copied the ADO ConnectionString in FD ConnectionString with hope it will work. P.S. Even if you set the connection at design time, if you can share the resulting ConnectionString, should be enough for start.
-
Thank you for your response! It seems the problem is much bigger then I thought. I did quite some digging and tests and here is short summary: 1. [Windows] ODBC keep two separate sets of providers for 32/64 bit. 2. [Windows] Depending on the version of your app, you can use only one set. 3. [Windows] Natively, in 32 version you can handle only the old (.mdb) Access format. 4. [MS Office] If you have Office installed, you are stuck with whatever version you had installed. Not 100% sure, but latest versions are x64 only. 5. [MS Office] That means, I cant install the drivers in the link. Not without removing the Office first! 6. [Delphi] Comes as 32 bit application! That mean in Design time, you can set connections only for 32bit set. 7. [Delphi] For 64 bit, runtime ONLY setup! Good luck juggling all above to deliver a seamless application to your clients ...
-
Hey guys, I have TDBLookupComboBox with multiple columns specified in ListField, that are displayed during DropDown. How I can change the width of individual column there? The defaults puts too much space between. Also is there a way to put a header on columns?
-
Change of column widths of ListField in TDBLookupComboBox
Squall_FF8 replied to Squall_FF8's topic in VCL
DisplayWidth change the width of the whole Drop down, I'm trying to change the widths of individual columns inside that DropDown. Let say I have 3 fields in ListField: Field1, Field 2 and Field 3. I want to change how wide they are during DropDown. -
Hey Guys, I have a TDBLookupComboBox with all properties set up to show proper info in the DropDown - ListSource, KeyField, ListField. It links to a query that has ID and Name fields. Is it possible to select the appropriate Name, based on an ID, without using a DataSource (the field)? If so - how to do that by code? An example, I have ID = 100, I want the Name with that ID to be select by the combo.