![]() |
| Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir. |
Açılan Console Ekranını Kapatma |
Yanıt Yaz
|
| Yazar | |
M-Guney
Kıdemli Üye
Kayıt Tarihi: 16 Eylül 2025 Konum: Konya, Meram, K Durum: Aktif Değil Puanlar: 153 |
Mesaj Seçenekleri
Teşekkürler(0)
Alıntı Cevapla
Konu: Açılan Console Ekranını KapatmaGönderim Zamanı: 7 Saat 23 Dakika Önce Saat 14:46 |
|
Kodumda eğer ki bilgiler yanlış girilirse timeout veriyor ve ardından bir console ekranı açılıyor o ekranı kapatmanın yolunu bulamadım. Mobilde o ekran geldikten sonra Edit inputlarını bozuyor değişmiş olan input u görmüyor eskiye sabit kalıyor.
var ConfigList : TClStringList; ConfigPath : String; WatchdogTimer : TClTimer; IsChecking : Boolean; InheritedForm : TclForm; CheckQuery : TClSqlQuery; void InitForm(AForm : TclForm); { InheritedForm = AForm; } void InitConfig; { try ConfigPath = Clomosy.AppFilesPath + 'db_config.txt'; if (ConfigList == nil) { ConfigList = Clomosy.StringListNew; } if (clFileExists('db_config.txt', Clomosy.AppFilesPath)) { ConfigList.Text = clLoadFromFile(ConfigPath); } except ShowMessage('InitConfig Exception: ' + LastExceptionMessage); } } void SaveDBConnection(AHost, AUser, APass, ADBName : String; APort: Integer); { try if (ConfigList == nil) { ConfigList = Clomosy.StringListNew; } ConfigList.Clear; ConfigList.Add('Host=' + AHost); ConfigList.Add('User=' + AUser); ConfigList.Add('Pass=' + APass); ConfigList.Add('DB=' + ADBName); ConfigList.Add('Port=' + IntToStr(APort)); clSaveToFile(ConfigPath, ConfigList.Text); ShowMessage('Database configuration saved successfully.'); except ShowMessage('SaveDBConnection Exception: ' + LastExceptionMessage); } } void OnHealthTimeout; { if (IsChecking == True) { IsChecking = False; WatchdogTimer.Enabled = False; ShowMessage('Connection Timeout: Server 5 saniye içinde cevap vermedi.'); } } void SetupTimer; { if ((WatchdogTimer == nil) && (InheritedForm <> nil)) { WatchdogTimer = InheritedForm.AddNewTimer(InheritedForm, 'WatchdogTimer', 5000); WatchdogTimer.Enabled = False; InheritedForm.AddNewEvent(WatchdogTimer, tbeOnTimer, 'OnHealthTimeout'); } } function CheckDatabaseHealth(AHost, AUser, APass, ADBName : String; APort: Integer): Boolean; { try Result = False; SetupTimer; if (WatchdogTimer == nil) { ShowMessage('Hata: Timer başlatılamadı. InitForm çağrıldığından emin olun.'); exit; } IsChecking = True; WatchdogTimer.Interval = 5000; WatchdogTimer.Enabled = True; // Step 1: Connectivity Check Clomosy.DBSQLServerConnect('SQL Server', AHost, AUser, APass, ADBName, APort); // Step 2: Lazy Initialization of Query CheckQuery.SQL.Text = 'SELECT DB_ID(' + QuotedStr(ADBName) + ') as db_found'; CheckQuery.Open; if (IsChecking == True) { IsChecking = False; WatchdogTimer.Enabled = False; if (CheckQuery.FieldByName('db_found').AsString == '') { ShowMessage('Hata: Database bulunamadı.'); Result = False; } else { Clomosy.DBSQLServerConnect('SQL Server', AHost, AUser, APass, ADBName, APort); Result = True; } } except IsChecking = False; if (WatchdogTimer <> nil) { WatchdogTimer.Enabled = False; } ShowMessage('Bağlantı Hatası: ' + LastExceptionMessage); Result = False; } } function LoadAndConnect: Boolean; var vHost, vUser, vPass, vDB : String; vPort : Integer; { InitConfig; try Result = False; if (ConfigList.Count > 0) { vHost = ConfigList.Values['Host']; vUser = ConfigList.Values['User']; vPass = ConfigList.Values['Pass']; vDB = ConfigList.Values['DB']; if (ConfigList.Values['Port'] == '') { vPort = 1433; } else { vPort = StrToInt(ConfigList.Values['Port']); } Result = CheckDatabaseHealth(vHost, vUser, vPass, vDB, vPort); } else { ShowMessage('Ayarlar bulunamadı.'); Result = False; } except ShowMessage('LoadAndConnect Exception: ' + LastExceptionMessage); Result = False; } } { WatchdogTimer = nil; } https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">
|
|
![]() |
|
M-Guney
Kıdemli Üye
Kayıt Tarihi: 16 Eylül 2025 Konum: Konya, Meram, K Durum: Aktif Değil Puanlar: 153 |
Mesaj Seçenekleri
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 7 Saat 19 Dakika Önce Saat 14:50 |
|
Kodun Doğru Hali
var ConfigList : TClStringList; ConfigPath : String; WatchdogTimer : TClTimer; IsChecking : Boolean; InheritedForm : TclForm; CheckQuery : TClSqlQuery; void InitForm(AForm : TclForm); { InheritedForm = AForm; } void InitConfig; { try ConfigPath = Clomosy.AppFilesPath + 'db_config.txt'; if (ConfigList == nil) { ConfigList = Clomosy.StringListNew; } if (clFileExists('db_config.txt', Clomosy.AppFilesPath)) { ConfigList.Text = clLoadFromFile(ConfigPath); } except ShowMessage('InitConfig Exception: ' + LastExceptionMessage); } } void SaveDBConnection(AHost, AUser, APass, ADBName : String; APort: Integer); { try if (ConfigList == nil) { ConfigList = Clomosy.StringListNew; } ConfigList.Clear; ConfigList.Add('Host=' + AHost); ConfigList.Add('User=' + AUser); ConfigList.Add('Pass=' + APass); ConfigList.Add('DB=' + ADBName); ConfigList.Add('Port=' + IntToStr(APort)); clSaveToFile(ConfigPath, ConfigList.Text); ShowMessage('Database configuration saved successfully.'); except ShowMessage('SaveDBConnection Exception: ' + LastExceptionMessage); } } void OnHealthTimeout; { if (IsChecking == True) { IsChecking = False; WatchdogTimer.Enabled = False; ShowMessage('Connection Timeout: Server 5 saniye içinde cevap vermedi.'); } } void SetupTimer; { if ((WatchdogTimer == nil) && (InheritedForm <> nil)) { WatchdogTimer = InheritedForm.AddNewTimer(InheritedForm, 'WatchdogTimer', 5000); WatchdogTimer.Enabled = False; InheritedForm.AddNewEvent(WatchdogTimer, tbeOnTimer, 'OnHealthTimeout'); } } function CheckDatabaseHealth(AHost, AUser, APass, ADBName : String; APort: Integer): Boolean; { try Result = False; SetupTimer; if (WatchdogTimer == nil) { ShowMessage('Hata: Timer başlatılamadı. InitForm çağrıldığından emin olun.'); exit; } IsChecking = True; WatchdogTimer.Interval = 5000; WatchdogTimer.Enabled = True; // Step 1: Connectivity Check Clomosy.DBSQLServerConnect('SQL Server', AHost, AUser, APass, ADBName, APort); // Step 2: Lazy Initialization of Query CheckQuery = Clomosy.DBSQLServerQuery; CheckQuery.SQL.Text = 'SELECT DB_ID(' + QuotedStr(ADBName) + ') as db_found'; CheckQuery.Open; if (IsChecking == True) { IsChecking = False; WatchdogTimer.Enabled = False; if (CheckQuery.FieldByName('db_found').AsString == '') { ShowMessage('Hata: Database bulunamadı.'); Result = False; } else { Clomosy.DBSQLServerConnect('SQL Server', AHost, AUser, APass, ADBName, APort); Result = True; } } except IsChecking = False; if (WatchdogTimer <> nil) { WatchdogTimer.Enabled = False; } ShowMessage('Bağlantı Hatası: ' + LastExceptionMessage); Result = False; } } function LoadAndConnect: Boolean; var vHost, vUser, vPass, vDB : String; vPort : Integer; { InitConfig; try Result = False; if (ConfigList.Count > 0) { vHost = ConfigList.Values['Host']; vUser = ConfigList.Values['User']; vPass = ConfigList.Values['Pass']; vDB = ConfigList.Values['DB']; if (ConfigList.Values['Port'] == '') { vPort = 1433; } else { vPort = StrToInt(ConfigList.Values['Port']); } Result = CheckDatabaseHealth(vHost, vUser, vPass, vDB, vPort); } else { ShowMessage('Ayarlar bulunamadı.'); Result = False; } except ShowMessage('LoadAndConnect Exception: ' + LastExceptionMessage); Result = False; } } { WatchdogTimer = nil; } https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">
|
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 524 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 3 Saat 42 Dakika Önce Saat 18:27 |
|
Merhaba Güney,
Son konuda kodun doğru demişsin. Şu an mevcut hatan devam ediyor mu?https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">< defer="" ="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28on72PdrCzSjY4U6VaAw1EQ==" -cf-beacon=""version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"_timing":"name":"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true,"location_startswith":null" crossorigin="anonymous"> Düzenleyen Emr.Erkmn - 3 Saat 41 Dakika Önce Saat 18:28 |
|
![]() |
|
Yanıt Yaz
|
|
| Tweet |
| Forum Atla | Forum İzinleri ![]() Kapalı Foruma Yeni Konu Gönderme Kapalı Forumdaki Konulara Cevap Yazma Kapalı Forumda Cevapları Silme Kapalı Forumdaki Cevapları Düzenleme Kapalı Forumda Anket Açma Kapalı Forumda Anketlerde Oy Kullanma |