Author: andreas
Date: 2005-10-23 12:11:06 +0100 (Sun, 23 Oct 2005)
New Revision: 4592

Modified:
   trunk/pgadmin3/src/dlg/dlgProperty.cpp
Log:
fix initial focus for dialogs

Modified: trunk/pgadmin3/src/dlg/dlgProperty.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgProperty.cpp      2005-10-23 09:02:42 UTC (rev 
4591)
+++ trunk/pgadmin3/src/dlg/dlgProperty.cpp      2005-10-23 11:11:06 UTC (rev 
4592)
@@ -276,6 +276,12 @@
     if (statusBar)
         statusBar->SetStatusText(wxEmptyString);
 
+    if (nbNotebook)
+    {
+        wxNotebookPage *pg=nbNotebook->GetPage(0);
+        if (pg)
+            pg->SetFocus();
+    }
     if (modal)
         return ShowModal();
     else
@@ -283,6 +289,7 @@
     return 0;
 }
 
+
 void dlgProperty::CreateAdditionalPages()
 {
     sqlPane = new ctlSQLBox(nbNotebook, CTL_PROPSQL, wxDefaultPosition, 
wxDefaultSize, wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY | wxTE_RICH2);
@@ -301,19 +308,19 @@
 void dlgProperty::AppendNameChange(wxString &sql, const wxString &objName)
 {
     if (GetObject()->GetName() != GetName())
-       {
-               if (objName.Length() > 0)
-               {
-                       sql += wxT("ALTER ") + objName
-                               +  wxT(" RENAME TO ") + qtIdent(GetName())
-                               +  wxT(";\n");
-               } else {
-                       sql += wxT("ALTER ") + 
GetObject()->GetTypeName().MakeUpper()
-                   +  wxT(" ") + GetObject()->GetQuotedFullIdentifier()
-                               +  wxT(" RENAME TO ") + qtIdent(GetName())
-                               +  wxT(";\n");
-               }
-       }
+    {
+        if (objName.Length() > 0)
+        {
+            sql += wxT("ALTER ") + objName
+                +  wxT(" RENAME TO ") + qtIdent(GetName())
+                +  wxT(";\n");
+        } else {
+            sql += wxT("ALTER ") + GetObject()->GetTypeName().MakeUpper()
+                +  wxT(" ") + GetObject()->GetQuotedFullIdentifier()
+                +  wxT(" RENAME TO ") + qtIdent(GetName())
+                +  wxT(";\n");
+        }
+    }
 }
 
 
@@ -833,25 +840,25 @@
             case PGOID_TYPE_BIT:
             case PGOID_TYPE_BIT_ARRAY:
             case PGOID_TYPE_CHAR:
-                       case PGOID_TYPE_CHAR_ARRAY:
+            case PGOID_TYPE_CHAR_ARRAY:
             case PGOID_TYPE_VARCHAR:
-                       case PGOID_TYPE_VARCHAR_ARRAY:
+            case PGOID_TYPE_VARCHAR_ARRAY:
                 vartyp=wxT("L");
                 break;
             case PGOID_TYPE_TIME:
-                       case PGOID_TYPE_TIME_ARRAY:
+            case PGOID_TYPE_TIME_ARRAY:
             case PGOID_TYPE_TIMETZ:
-                       case PGOID_TYPE_TIMETZ_ARRAY:
+            case PGOID_TYPE_TIMETZ_ARRAY:
             case PGOID_TYPE_TIMESTAMP:
-                       case PGOID_TYPE_TIMESTAMP_ARRAY:
+            case PGOID_TYPE_TIMESTAMP_ARRAY:
             case PGOID_TYPE_TIMESTAMPTZ:
-                       case PGOID_TYPE_TIMESTAMPTZ_ARRAY:
+            case PGOID_TYPE_TIMESTAMPTZ_ARRAY:
             case PGOID_TYPE_INTERVAL:
-                       case PGOID_TYPE_INTERVAL_ARRAY:
+            case PGOID_TYPE_INTERVAL_ARRAY:
                 vartyp=wxT("D");
                 break;
             case PGOID_TYPE_NUMERIC:
-                       case PGOID_TYPE_NUMERIC_ARRAY:
+            case PGOID_TYPE_NUMERIC_ARRAY:
                 vartyp=wxT("P");
                 break;
             default:
@@ -889,15 +896,15 @@
 wxString dlgTypeProperty::GetQuotedTypename(int sel)
 {
     wxString sql;
-       bool isArray = false;
+    bool isArray = false;
 
     if (sel >= 0)
     {
         sql = types.Item(sel).AfterFirst(':');
-               if (sql.Contains(wxT("[]"))) {
-                       sql = sql.BeforeFirst('[');
-                       isArray = true;
-               }
+        if (sql.Contains(wxT("[]"))) {
+            sql = sql.BeforeFirst('[');
+            isArray = true;
+        }
 
         if (isVarLen && txtLength)
         {
@@ -916,7 +923,7 @@
         }
     }
 
-       if (isArray) sql += wxT("[]");
+    if (isArray) sql += wxT("[]");
     return sql;
 }
 
@@ -1044,7 +1051,7 @@
                     wxString name=str.BeforeLast('=');
                     wxString value;
 
-                                       connection = obj->GetConnection();
+                    connection = obj->GetConnection();
                     if (connection->BackendMinimumVersion(7, 4))
                         value=str.Mid(name.Length()+1).BeforeLast('/');
                     else
@@ -1071,7 +1078,7 @@
             }
         }
     }else
-       securityPage = NULL;
+    securityPage = NULL;
 }
 
 
@@ -1171,7 +1178,7 @@
     if (securityPage)
         return securityPage->GetGrant(allPattern, grantObject, &currentAcl);
     else
-       return wxString();
+    return wxString();
 }
 
 
@@ -1209,28 +1216,28 @@
     sql=GetInsertSql();
     if (!sql.IsEmpty())
     {
-               int pos;
-               long jobId=0, schId=0, stpId=0;
-               if (sql.Contains(wxT("<JobId>")))
-               {
-                       recId = 
jobId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_job_jobid_seq');")));
+        int pos;
+        long jobId=0, schId=0, stpId=0;
+        if (sql.Contains(wxT("<JobId>")))
+        {
+            recId = jobId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_job_jobid_seq');")));
             while ((pos=sql.Find(wxT("<JobId>"))) >= 0)
                 sql = sql.Left(pos) + NumToStr(jobId) + sql.Mid(pos+7);
-               }
-               
-               if (sql.Contains(wxT("<SchId>")))
-               {
-                       recId = 
schId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_schedule_jscid_seq');")));
-                       while ((pos=sql.Find(wxT("<SchId>"))) >= 0)
+        }
+        
+        if (sql.Contains(wxT("<SchId>")))
+        {
+            recId = schId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_schedule_jscid_seq');")));
+            while ((pos=sql.Find(wxT("<SchId>"))) >= 0)
                 sql = sql.Left(pos) + NumToStr(schId) + sql.Mid(pos+7);
-               }
+        }
 
-               if (sql.Contains(wxT("<StpId>")))
-               {
-                       recId = 
stpId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_jobstep_jstid_seq');")));
-                       while ((pos=sql.Find(wxT("<StpId>"))) >= 0)
+        if (sql.Contains(wxT("<StpId>")))
+        {
+            recId = stpId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_jobstep_jstid_seq');")));
+            while ((pos=sql.Find(wxT("<StpId>"))) >= 0)
                 sql = sql.Left(pos) + NumToStr(stpId) + sql.Mid(pos+7);
-               }
+        }
 
         pgSet *set=connection->ExecuteSet(sql);
         if (set)
@@ -1251,20 +1258,20 @@
         while ((pos=sql.Find(wxT("<JobId>"))) >= 0)
             sql = sql.Left(pos) + NumToStr(recId) + sql.Mid(pos+7);
 
-               long newId;
-               if (sql.Contains(wxT("<SchId>")))
-               {
-                       newId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_schedule_jscid_seq');")));
-                       while ((pos=sql.Find(wxT("<SchId>"))) >= 0)
+        long newId;
+        if (sql.Contains(wxT("<SchId>")))
+        {
+            newId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_schedule_jscid_seq');")));
+            while ((pos=sql.Find(wxT("<SchId>"))) >= 0)
                 sql = sql.Left(pos) + NumToStr(newId) + sql.Mid(pos+7);
-               }
+        }
 
-               if (sql.Contains(wxT("<StpId>")))
-               {
-                       newId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_jobstep_jstid_seq');")));
-                       while ((pos=sql.Find(wxT("<StpId>"))) >= 0)
+        if (sql.Contains(wxT("<StpId>")))
+        {
+            newId=StrToLong(connection->ExecuteScalar(wxT("SELECT 
nextval('pgagent.pga_jobstep_jstid_seq');")));
+            while ((pos=sql.Find(wxT("<StpId>"))) >= 0)
                 sql = sql.Left(pos) + NumToStr(newId) + sql.Mid(pos+7);
-               }
+        }
 
         if (!connection->ExecuteVoid(sql))
         {


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to