: TObject) ;. Text:= raquo ;;. Font.Color:=clBlack; .SQL.Clear ; .Close; .SQL.Add ( SELECT region_name FROM regions ORDER BY region_name ) ;. Open; .Items.Clear; not q1.Eof do.Items.Add (q1 [ region_name ]) ;. Next ;;. DroppedDown:=true ;; TMainForm1.DestStreetComboBoxChange (Sender: TObject); s: String; DestStreetComboBox.Text lt; gt; then.SQL.Clear; .Close; .SQL.Add ( SELECT tel_code FROM ulicy WHERE street_name= + (DestStreetComboBox.Text)) ;. Open; not q1.Eof then:=q1 [ tel_code ] ; .Close; .SQL.Clear; .SQL.Add ( SELECT region_name FROM regions WHERE tel_code= + s) ;. Open; q1 [ region_name ] lt; gt; Null then.Text:=q1 [ region_name ] ;;;; TMainForm1.DestStreetComboBoxEnter (Sender: TObject) ;. Text:= raquo ;;. SQL.Clear; .Close; .SQL.Add ( SELECT street_name FROM ulicy ORDER BY street_name ) ;. Open; .Items.Clear; not q1.Eof do.Items.Add (q1 [ street_name ]) ;. Next ;;. DroppedDown:=true ;; TMainForm1. DestStreetComboBoxKeyPress (Sender: TObject; var Key: Char);:=DestStreetComboBox; (Key);
; TMainForm1.DriverListBoxClick (Sender: TObject) ;. Repaint ;; TMainForm1.DriverListBoxDblClick (Sender: TObject) ;. ShowModal ;; TMainForm1.DriverListBoxDrawItem (Control: TWinControl ;: Integer; Rect: TRect; State: TOwnerDrawState); TextWidth, TextHeight: Integer ;, x, y: integer ;: String;:=DriverListBox.Items [Index];:=clLtGray; i:=0 to LocationGrid.RowCount - 1 doLocationGrid.Cells [2, i]=s thenStrToInt (LocationGrid.Cells [0, i]) of
, 1 ::=clLime;
::=clYellow;
::=clRed ;;;;;. Canvas.Brush.Color:=RowColor; .Canvas.Font.Color:=clBlack; DriverListBox.ItemIndex=Index then.Canvas.Font.Color: =clBlue; .Canvas.Font.Style:=[fsBold];
end;
//Зафарбовуємо текст (Text). Також тут можна додати вирівнювання
DriverListBox.Canvas.FillRect (Rect);:=DriverListBox.Canvas.TextWidth (s);:=DriverListBox.Canvas.TextHeight (s);:=Rect.Left + (Rect.Right -Rect.Left) div 2 - TextWidth div 2;:=Rect.Top + (Rect.Bottom - Rect.Top) div 2 - TextHeight div 2; .Canvas.TextOut (x, y, s) ;; TMainForm1.DriverListBoxEnter ( Sender: TObject); s: String ;: Integer; L_next_while;:=DriverListBox.ItemIndex; .SQL.Clear; .Close; .SQL.Add ( SELECT cars.voditel FROM travels, cars WHERE cars.id=voditel_id ORDER BY cars.voditel ASC ) ;. Open; .Items.Clear; not q1.Eof do:=q1 [ voditel ]; I:=0 to DriverListBox.Items.Count - 1 doDriverListBox.Items [i]= s thenL_next_while; .Items.Add (s); _ next_while: .Next ;;. SQL.Clear; .Close; .SQL.Add ( SELECT voditel, cars.id FROM cars WHERE cars.id NOT IN (SELECT travels. voditel_id FROM travels) ) ;. Open; not q1.Eof do:=q1 [ voditel ] ;. Items.Add (s);
//L_next_while: .Next ;;
//DriverListBox.DroppedDown:=true; oldIndex lt; DriverListBox.Items.Count then DriverListBox.ItemIndex:=oldIndex; .Repaint ;; TMainForm1.FormClose (Sender: TObject; var Action: TCloseAction) ;. Close ;; TMainForm1.FormCreate (Sender: TObject) ;. ColWidths [0]: =0; .ColWidths [1]:=0; .ColWidths [8]:=0; .ColWidths [0]:=0; .ColWidths [1]:=0; .ColWidths [8]:=0 ;; TMainForm1.FormKeyPress (Sender: TObject; var Key: Char); Key=# 27 then Close ;; TMainForm1.FormShow (Sender: TObject); State, Row, oldRow, oldCol: Integer ;: String ;: Boolean; L_next;:= LocationGrid.Row;:=LocationGrid.Col;
{for I:=0 to LocationGrid.RowCount - 1 do.Rows [i] .Clear; .RowCount:=0;
}. Close; .SQL.Clear; .SQL.Add ( SELECT cars.voditel, voditel_id, place, from_region, to_region, state, time_send, +
state_id, state_name, time_out +
FROM travels, states, cars WHERE (state=state_id) AND (voditel_id=cars.id) +
ORDER BY time_send DESC );
//LocationGrid.Font.Style:=[fsBold];.Rows[0].Add(laquo;raquo;);.Rows[0].Add(laquo;raquo;);.Rows[0].Add(laquo;Водительraquo;);.Rows[0].Add(laquo;Статусraquo;);.Rows[0].Add(laquo;Едет з ) ;. Rows [0] .Add ( Їде в ) ;. Rows [0] .Add ( Відправлений ) ;. Rows [0] .Add ( Зараз у ) ;. Open ;:=0; LocationGrid.RowCount lt; gt; q1.RecordCount then.RowCount:=q1.RecordCount; I:=0 to LocationGrid.RowCount - 1 do.Rows [i] .Clear ;;:=false; I:=0 to LocationGrid.RowCount - 1 do.Cells [ 1, i]:= raquo ;; not q1.Eof do
beginq1 [ voditel_id ] lt; gt; NULL then//виключити повторюваних водіїв
for I:=0 to LocationGrid.RowCount - 1 doLocationGrid.Cells [1, i]=String (q1 [ voditel_id ]) thenL_next;
//LocationGrid.RowCount:=LocationGrid.RowCount + 1; I:=0 to 8 doq1 [Fields [i]] lt; gt; NULL thenLocationGrid.Cells [i, Row] lt; gt; String (q1 [Fields [i]]) then.Cells [i, Row]:=String (q1 [Fields [i]]);: =true ;;